mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-07 02:35:10 +01:00
Update modified field, added some comments
This commit is contained in:
@@ -237,7 +237,7 @@ def addbookmark(userkey):
|
|||||||
|
|
||||||
|
|
||||||
def updatebookmark(userkey, request, urlhash = None):
|
def updatebookmark(userkey, request, urlhash = None):
|
||||||
""" Add or edit bookmark """
|
""" Add (no urlhash) or edit (urlhash is set) a bookmark """
|
||||||
title = request.form.get('title')
|
title = request.form.get('title')
|
||||||
url = request.form.get('url')
|
url = request.form.get('url')
|
||||||
tags = request.form.get('tags')
|
tags = request.form.get('tags')
|
||||||
@@ -246,13 +246,16 @@ def updatebookmark(userkey, request, urlhash = None):
|
|||||||
starred = True
|
starred = True
|
||||||
|
|
||||||
if url and not urlhash:
|
if url and not urlhash:
|
||||||
#bookmark = Bookmark(url=url, title=title, starred=starred, userkey=userkey)
|
# New bookmark
|
||||||
bookmark, created = Bookmark.get_or_create(url=url, userkey=userkey)
|
bookmark, created = Bookmark.get_or_create(url=url, userkey=userkey)
|
||||||
if not created:
|
if not created:
|
||||||
message = 'Existing bookmark, did not overwrite with new values'
|
message = 'Existing bookmark, did not overwrite with new values'
|
||||||
return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash, message=message))
|
return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash, message=message))
|
||||||
elif url:
|
elif url:
|
||||||
|
# Existing bookmark, get from DB
|
||||||
bookmark = Bookmark.get(userkey == userkey, Bookmark.url_hash == urlhash)
|
bookmark = Bookmark.get(userkey == userkey, Bookmark.url_hash == urlhash)
|
||||||
|
# Editing this bookmark, set modified_date to now
|
||||||
|
bookmark.modified_date = datetime.datetime.now()
|
||||||
|
|
||||||
bookmark.title = title
|
bookmark.title = title
|
||||||
bookmark.url = url
|
bookmark.url = url
|
||||||
|
|||||||
Reference in New Issue
Block a user