SmartFIRE templates updates
[myslice.git] / portal / actions.py
index 4dda370..b7ee9a0 100644 (file)
@@ -445,7 +445,8 @@ def delete_local_user(wsgi_request, user_email):
         user_config = json.loads(user[0]['config'])
         authority_hrn = user_config.get('authority', None)
         
-        if is_pi(wsgi_request, '$user_hrn', authority_hrn):
+        #if is_pi(wsgi_request, '$user_hrn', authority_hrn):
+        try:
             # removing from Django auth_user
             UserModel = get_user_model()
             UserModel._default_manager.filter(email__iexact = user_email).delete()
@@ -455,9 +456,9 @@ def delete_local_user(wsgi_request, user_email):
                      
             # removing manifold user
             manifold_delete_user(wsgi_request, user_id)
-        else:
-            return False
-            #raise Exception, "No sufficient rights on authority = ",authority_hrn
+        except Exception, e:
+            #return False
+            print "No sufficient rights on authority = ",authority_hrn
 
     return True      
 
@@ -677,13 +678,14 @@ def portal_validate_request(wsgi_request, request_ids):
                 a = PendingAuthority.objects.get(id=request['id'])
                 ctx = { 
                     'site_name'     : a.site_name,
-                    'short_name'    : a.short_name,
-                    'url'           : a.url,
-                    'city'          : a.city,
-                    'country'       : a.country,                          
-                    'portal_url'    : a.current_site,
+                    #'short_name'    : a.short_name,
+                    #'url'           : a.url,
+                    'city'          : a.address_city,
+                    'country'       : a.address_country,                          
+                    #'portal_url'    : a.current_site,
                 }
-                user_email = a.email
+                # address_line1 contains the email of the user in pending_authority table
+                user_email = a.address_line1
 
                 PendingAuthority.objects.get(id=request['id']).delete()
                 
@@ -907,7 +909,7 @@ def send_status_email(request, ctx, user_email, obj_type, status):
         sender =  render_to_string(theme.template, ctx)
         sender = sender.replace('\n', '')
                        
-        subject = obj_type + ' request '+ status +'.'
+        subject = obj_type.title() + ' request '+ status
     
         msg = EmailMultiAlternatives(subject, text_content, sender, [user_email])
         msg.attach_alternative(html_content, "text/html")