예제 #1
0
 def view(self,id=0):
     if not c.user:
         redirect_to(controller='home', action='index', id=None)
     
     if c.user.issysadmin and id > 0:
         person = Person.get(-1,id)
     elif id > 0: 
         person = Person.get(c.user.site_id,id)
     
     return self._view(person,True)
예제 #2
0
파일: site.py 프로젝트: cccarey/demisauce
 def edit_POST(self,id = 0):
     """
     User has selected to change site config info
     """
     if 'objectid' in request.params:
         site = Site.get(-1,request.params['objectid'])
         
         if site is None:
             h.add_error("We experienced an error, please try again")
             
         else:
             site.name = self.form_result['name']
             site.description = self.form_result['description']
             site.email = self.form_result['email']
             site.slug = self.form_result['real_permalink']
             # TODO, check uniqueness
             site.public = bool(self.form_result['public'])
             site.base_url = self.form_result['base_url']
             site.site_url = self.form_result['site_url']
             site.save()
             
             # refresh session store
             user = Person.get(c.user.site_id,c.user.id)
             self.start_session(user)
             h.add_alert("Site settings were updated")
             
         
     else:
         h.add_error("There was an Error")
     
     return redirect_wsave('/site/view')
예제 #3
0
파일: help.py 프로젝트: cccarey/demisauce
 def get_user(self):
     '''grabs person record for submitter'''
     if self.person_id and self.person_id > 0:
         if not hasattr(self,'_person'):
             temp = Person.get(-1,self.person_id)
             if temp:
                 self._person = temp
             else:
                 self._person = None
     return self._person
예제 #4
0
 def account_edit(self):
     """
     User has selected to update profile
     """
     if c.user and 'email' in request.POST:
         user = Person.get(c.user.site_id,c.user.id)
         user.displayname = request.POST['displayname']
         user.set_email(request.POST['email'])
         user.url = request.POST['url']
         self.start_session(user)
         user.save()
         c.person = user
         c.user = user
         self.start_session(user)
     return render('/account/settings.html')
예제 #5
0
 def view_mini(self,id=0):
     c.person = None
     if id > 0: # authenticated user
         person = Person.get(c.user.site_id,id)
         c.person = person
     return render('/account/profile_mini.html')