예제 #1
0
파일: site.py 프로젝트: cccarey/demisauce
 def view(self,id = 0):
     if id > 0 and (c.user is not None) and c.user.issysadmin:
         c.item = Site.saget(id)
     elif id is None or id == '' and c.user:
         c.item = Site.get(-1,c.user.site_id)
     else:
         c.item = Site.get(-1,id)
         if not c.item.public:
             c.item = None
     return render('/site/site.html')
예제 #2
0
파일: site.py 프로젝트: araddon/demisauce
 def view(self, id=0):
     id = int(id) if id is not None else 0
     log.debug("in site view id= %s" % (id))
     if id > 0 and (self.user is not None) and self.user.issysadmin:
         item = Site.saget(id)
     elif self.user and ((id is None or id == 0) or (self.user.site_id == id)):
         item = Site.get(-1, self.user.site_id)
     else:
         item = Site.get(-1, id)
         if not item.public:
             item = None
     self.render("site/site.html", viewing_user=self.user, item=item)
예제 #3
0
파일: api.py 프로젝트: araddon/demisauce
 def action_get_object(self,id, data_dict = {}):
     if self.site.is_sysadmin == True or (self.site.id == self.id or self.site.slug == self.id):
         if type(id) == int and id > 0:
             self.object = Site.saget(id) 
         elif type(id) == int and id == 0 and 'slug' in data_dict:
             log.debug("they asked for id = 0, lets ignore and doublecheck slug = %s" % data_dict['slug'])
             self.object = Site.by_slug(data_dict['slug'])
         else:
             log.debug("they asked for id = %s, lets ignore and doublecheck slug" % (self.id))
             self.object = Site.by_slug(self.id)   
         if self.object:
             self.qry = [self.object]
         else:
             self.set_status(404)
             log.error("no site %s, status=%s" % (self.id, self._status_code))