diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 7a992256e5..cd4f61fcd6 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -145,6 +145,7 @@ class InvalidStatusError(ValidationError): pass class DoesNotExistError(ValidationError): pass class MandatoryError(ValidationError): pass class InvalidSignatureError(ValidationError): pass +class RateLimitExceededError(ValidationError): pass def get_traceback(): import utils diff --git a/webnotes/core/doctype/page/page.txt b/webnotes/core/doctype/page/page.txt index 4df76264cd..812c69050c 100644 --- a/webnotes/core/doctype/page/page.txt +++ b/webnotes/core/doctype/page/page.txt @@ -2,7 +2,7 @@ { "creation": "2012-12-20 17:16:49", "docstatus": 0, - "modified": "2013-12-20 19:24:15", + "modified": "2013-12-30 13:48:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -79,11 +79,11 @@ { "doctype": "DocField", "fieldname": "module", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Module", "oldfieldname": "module", "oldfieldtype": "Select", - "options": "link:Module Def", + "options": "Module Def", "reqd": 1 }, { diff --git a/webnotes/core/page/desktop/desktop.js b/webnotes/core/page/desktop/desktop.js index c8685c8b59..d0edf24842 100644 --- a/webnotes/core/page/desktop/desktop.js +++ b/webnotes/core/page/desktop/desktop.js @@ -18,7 +18,7 @@ wn.core.pages.desktop.render = function() { document.title = "Desktop"; var add_icon = function(m) { var module = wn.modules[m]; - if(!module) + if(!module || !module.link) return; if(!module.label) module.label = m; diff --git a/webnotes/db.py b/webnotes/db.py index 2c19bf67bf..6d282c86a0 100644 --- a/webnotes/db.py +++ b/webnotes/db.py @@ -490,7 +490,16 @@ class Database: return webnotes.conn.sql("""select count(*) from `tab%s`""" % (dt,))[0][0] - + + def get_creation_count(self, doctype, minutes): + """get count of records created in the last x minutes""" + from webnotes.utils import now_datetime + from dateutil.relativedelta import relativedelta + + return webnotes.conn.sql("""select count(name) from `tab{doctype}` + where creation >= %s""".format(doctype=doctype), + now_datetime() - relativedelta(minutes=minutes))[0][0] + def get_table_columns(self, doctype): return [r[0] for r in self.sql("DESC `tab%s`" % doctype)] diff --git a/webnotes/templates/base.html b/webnotes/templates/base.html index e971fa6d06..6cc49c7902 100644 --- a/webnotes/templates/base.html +++ b/webnotes/templates/base.html @@ -24,6 +24,7 @@ {% block css -%} {% if css %}{% endif %} {%- endblock %} + {% block style -%}{%- endblock %} {% block banner %} @@ -36,5 +37,6 @@ {% block content %}{% endblock %} {% block footer %}{% include "templates/includes/footer.html" %}{% endblock %} + {% block script -%}{%- endblock %} \ No newline at end of file diff --git a/webnotes/utils/__init__.py b/webnotes/utils/__init__.py index fbc85a30d2..f343a5c369 100644 --- a/webnotes/utils/__init__.py +++ b/webnotes/utils/__init__.py @@ -904,7 +904,7 @@ def touch_file(path): with open(path, 'a'): os.utime(path, None) return True - + class HashAuthenticatedCommand(object): def __init__(self): if hasattr(self, 'command'):