How to use the summer.model.entry.Entry.save_entry function in summer

To help you get started, we’ve selected a few summer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaowhen / summer / summer / view / post / post.py View on Github external
def save(id):
    title = request.form['title']
    content = request.form['content']

    _entry = Entry.save_entry(title, content, id)

    name = _entry['slug']
    date = _entry['date']
    status = _entry['status']

    if status == 'draft':
        filename = os.path.join('./summer/_draft/', name + '.md')
    else:
        filename = os.path.join('./summer/post/', name + '.md')

    open(filename, 'w').close()

    newfile = open(filename, 'w')

    meta = yaml.safe_dump({
        'title': title.encode('utf8'),