aboutsummaryrefslogtreecommitdiffstats
path: root/src/py/imc/auth.py
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-06-15 03:27:23 +0800
committerpzread <netfirewall@gmail.com>2013-06-15 03:27:23 +0800
commite8ab9406d9c1e4c0091eea35bf78638e92ed014b (patch)
tree1a16d0a5db115fd41cb6d4b54feece006e765ce7 /src/py/imc/auth.py
parentf7823d5630515a6aee93183dcaa6c8d0e5797f10 (diff)
downloadtaiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar.gz
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar.bz2
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar.lz
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar.xz
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.tar.zst
taiwan-online-judge-e8ab9406d9c1e4c0091eea35bf78638e92ed014b.zip
Add IMC filter support
Diffstat (limited to 'src/py/imc/auth.py')
-rw-r--r--src/py/imc/auth.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/py/imc/auth.py b/src/py/imc/auth.py
index 02dd2dc..84197a8 100644
--- a/src/py/imc/auth.py
+++ b/src/py/imc/auth.py
@@ -34,7 +34,7 @@ class Auth:
return idendesc
@staticmethod
- def change_current_iden(idendesc,auth = None):
+ def change_current_iden(idendesc = None,auth = None):
@contextlib.contextmanager
def context():
global current_idendata
@@ -44,9 +44,13 @@ class Auth:
if auth == None:
auth = Auth.instance
- iden = auth.get_iden(idendesc)
- if iden == None:
- raise ValueError('Illegal idendesc')
+ if idendesc == None:
+ iden = None
+
+ else:
+ iden = auth.get_iden(idendesc)
+ if iden == None:
+ raise ValueError('Illegal idendesc')
old_idendata = current_idendata
current_idendata = (iden,idendesc)