diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 03d71940ee..a209d4234d 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -121,6 +121,7 @@ class MappingMismatchError(ValidationError): pass class InvalidStatusError(ValidationError): pass class DoesNotExistError(ValidationError): pass class MandatoryError(ValidationError): pass +class InvalidSignatureError(ValidationError): pass def getTraceback(): import utils @@ -259,7 +260,6 @@ def whitelist(allow_guest=False, allow_roles=None): class HashAuthenticatedCommand(object): - def __init__(self): if hasattr(self, 'command'): import inspect @@ -271,10 +271,13 @@ class HashAuthenticatedCommand(object): if self.verify_signature(kwargs, signature): return self.command(*args, **kwargs) else: - raise Exception + self.signature_error() - def command(): + def command(self): raise NotImplementedError + + def signature_error(self): + raise InvalidSignatureError def get_signature(self, params, ignore_params=None): import hmac diff --git a/webnotes/db.py b/webnotes/db.py index b826746419..402ab0dcd3 100644 --- a/webnotes/db.py +++ b/webnotes/db.py @@ -400,6 +400,11 @@ class Database: doc.modified_by = webnotes.session["user"] self.set_value(doc.doctype, doc.name, field, val, doc.modified, doc.modified_by) doc.fields[field] = val + + def touch(self, doctype, docname): + from webnotes.utils import now + webnotes.conn.sql("""update `tab{doctype}` set `modified`=%s + where name=%s""".format(doctype=doctype), (now(), docname)) def set_global(self, key, val, user='__global'): self.set_default(key, val, user) diff --git a/website/templates/pages/message.html b/website/templates/pages/message.html index 333501edd3..6653f07410 100644 --- a/website/templates/pages/message.html +++ b/website/templates/pages/message.html @@ -3,7 +3,7 @@ {% set title=webnotes.local.message_title %} {% block content %} -