Closed mitechie closed 10 years ago
diff --git a/bookie/views/api.py b/bookie/views/api.py 81 index 909e42a..bcadcf7 100644 82 --- a/bookie/views/api.py 83 +++ b/bookie/views/api.py 84 @@ -193,7 +193,11 @@ def bmark_get(request): 85 86 def _update_mark(mark, params): 87 """Update the bookmark found with settings passed in""" 88 - mark.description = params.get('description', mark.description) 89 + description = params.get('description', None) 90 + if not description and mark: 91 + description = mark.description 92 + 93 + mark.description = description 94 mark.extended = params.get('extended', mark.extended) 95 96 new_tag_str = params.get('tags', None) 97 @@ -264,9 +268,12 @@ def bmark_add(request): 98 try: 99 mark = BmarkMgr.get_by_url(params['url'], 100 username=user.username) 101 - mark = _update_mark(mark, params) 102 - 103 except NoResultFound: 104 + mark = None 105 + 106 + if mark: 107 + mark = _update_mark(mark, params) 108 + else: 109 # then let's store this thing 110 # if we have a dt param then set the date to be that manual 111 # date
Patch applied, updated, and released.
diff --git a/bookie/views/api.py b/bookie/views/api.py 81 index 909e42a..bcadcf7 100644 82 --- a/bookie/views/api.py 83 +++ b/bookie/views/api.py 84 @@ -193,7 +193,11 @@ def bmark_get(request): 85 86 def _update_mark(mark, params): 87 """Update the bookmark found with settings passed in""" 88 - mark.description = params.get('description', mark.description) 89 + description = params.get('description', None) 90 + if not description and mark: 91 + description = mark.description 92 + 93 + mark.description = description 94 mark.extended = params.get('extended', mark.extended) 95
96 new_tag_str = params.get('tags', None) 97 @@ -264,9 +268,12 @@ def bmark_add(request): 98 try: 99 mark = BmarkMgr.get_by_url(params['url'], 100 username=user.username) 101 - mark = _update_mark(mark, params) 102 - 103 except NoResultFound: 104 + mark = None 105 + 106 + if mark: 107 + mark = _update_mark(mark, params) 108 + else: 109 # then let's store this thing 110 # if we have a dt param then set the date to be that manual 111 # date