Commits

hideki nara committed 278c3af

fix reverse

Comments (0)

Files changed (1)

bpmobile/utils.py

 def session_embedded_url(request,url,session='auto'):
     ''' DoCoMo : Session Embedded URL
     '''
-    if session == 'embed'  or ( 
-       session != 'none' and 
-       request != None and hasattr(request,'agent') and request.agent.is_docomo()):
-        url = re.sub(r';\(.+\)','',url )            #: delete old session key
-        parts = (url+'?').split('?')
-        return parts[0]+ ";(%s)"%  request.session.session_key  + "?" + parts[1]
+    if request:
+        if session == 'embed'  or all( [
+            session != 'none' ,
+            hasattr(request,'agent') ,
+            request.agent.is_docomo()]):
+            url = re.sub(r';\(.+\)','',url )            #: delete old session key
+            parts = (url+'?').split('?')
+            url = parts[0]+ ";(%s)"%  request.session.session_key  + "?" + parts[1]
+     
     return url
 
 from django.contrib.auth import login as auth_login
+from django.core.urlresolvers import reverse as default_reverse
 def login(request,user):    
     auth_login(request,user)        #:Default
     request.session['session_embedded'] = True