def action_get_object(self,id, data_dict = {}): if isinstance(id,int) and self.id > 0: self.object = App.saget(id) elif isinstance(id,int) and self.id == 0: if 'slug' in data_dict: self.object = App.by_slug(self.site.id,slug=data_dict['slug']) else: self.object = App.by_slug(site_id=self.site.id,slug=self.id) if self.object: self.qry = [self.object] else: self.set_status(404) log.error("no service %s" % self.id)
def appeditform(self,id=0): if id == 0 or id == None or id == '0': c.item = App() else: c.item = App.get(-1,id) if not (c.item.list_public or (c.user and c.user.site_id == c.item.site_id)): c.item = None return render('/service/app_edit.html')
def appeditform(self,id=0): if id == 0 or id == None or id == '0': item = App() else: item = App.get(-1,id) if not (item.list_public or (self.user and self.user.site_id == item.site_id)): item = None self.render('/service/app_edit.html',item=item)
def appedit(self,id=0): log.info('what the heck, in edit %s' % id) id = self.get_argument("app_id") site = Site.get(-1,self.user.site_id) if id == 0 or id == None or id == '0': app = App() app.site_id = site.id app.owner_id = self.user.id log.info('hm, id == 0') else: app = App.get(site.id,id) log.info('args = %s' % (str(self.request.arguments))) app.slug = sanitize(self.get_argument('real_permalink2')) app.name = sanitize(self.get_argument('app_name')) app.authn = sanitize(self.get_argument('authn')) #if 'description' in self.request.arguments: app.description = sanitize(self.get_argument('description','')) app.base_url = sanitize(self.get_argument('base_url')) app.save() self.write(str(app.id))
def apps(self,id=0): apps = App.by_site(self.user.site_id) self.render('/service/app.html',apps=apps)
def appview(self,id=0): item = App.get(-1,id) if not (item.list_public or (self.user and self.user.site_id == item.site_id)): item = None self.render('service/app.html',item=item)
def appview(self,id=0): c.item = App.get(-1,id) if not (c.item.list_public or (c.user and c.user.site_id == c.item.site_id)): c.item = None return render('/service/app.html')
def appedit(self,id=0): #log.info('what the heck, in edit %s' % id) id = request.POST['app_id'] site = Site.get(-1,c.site_id) if id == 0 or id == None or id == '0': app = App() app.site_id = site.id app.owner_id = c.user.id log.info('hm, id == 0') else: app = App.get(site.id,id) app.slug = sanitize(request.POST['real_permalink2']) app.name = sanitize(request.POST['app_name']) app.authn = sanitize(request.POST['authn']) app.description = sanitize(request.POST['description']) app.base_url = sanitize(request.POST['base_url']) app.save() return app.id
def apps(self,id=0): c.apps = App.by_site(c.site_id) return render('/service/app.html')