Procházet zdrojové kódy

[permission] [minor] moved 403 to handler.py

version-14
Rushabh Mehta před 12 roky
rodič
revize
af42359692
3 změnil soubory, kde provedl 8 přidání a 5 odebrání
  1. +6
    -1
      webnotes/handler.py
  2. +2
    -3
      webnotes/widgets/moduleview.py
  3. +0
    -1
      webnotes/widgets/reportview.py

+ 6
- 1
webnotes/handler.py Zobrazit soubor

@@ -131,7 +131,12 @@ def handle():
try: try:
execute_cmd(cmd) execute_cmd(cmd)
except webnotes.ValidationError, e: except webnotes.ValidationError, e:
webnotes.errprint(e)
webnotes.errprint(webnotes.utils.getTraceback())
if webnotes.request_method == "POST":
webnotes.conn.rollback()
except webnotes.PermissionError, e:
webnotes.errprint(webnotes.utils.getTraceback())
webnotes.response['403'] = 1
if webnotes.request_method == "POST": if webnotes.request_method == "POST":
webnotes.conn.rollback() webnotes.conn.rollback()
except: except:


+ 2
- 3
webnotes/widgets/moduleview.py Zobrazit soubor

@@ -15,11 +15,10 @@ def get_data(module, doctypes='[]'):
def get_count(doctypes): def get_count(doctypes):
count = {} count = {}
can_read = webnotes.user.get_can_read()
for d in doctypes: for d in doctypes:
try:
if doctype in can_read:
count[d] = get_doctype_count_from_table(d) count[d] = get_doctype_count_from_table(d)
except webnotes.PermissionError, e:
pass
return count return count


def get_doctype_count_from_table(doctype): def get_doctype_count_from_table(doctype):


+ 0
- 1
webnotes/widgets/reportview.py Zobrazit soubor

@@ -129,7 +129,6 @@ def load_doctypes():
if t.startswith('`'): if t.startswith('`'):
doctype = t[4:-1] doctype = t[4:-1]
if not webnotes.has_permission(doctype): if not webnotes.has_permission(doctype):
webnotes.response['403'] = 1
raise webnotes.PermissionError, doctype raise webnotes.PermissionError, doctype
doctypes[doctype] = webnotes.model.doctype.get(doctype) doctypes[doctype] = webnotes.model.doctype.get(doctype)


Načítá se…
Zrušit
Uložit