def get(self,tagname): result = Tag.all().filter('tag', tagname).filter('valid', True) tag = result.fetch(limit=1) if len(tag) > 0: tagname = tag[0].tag if users.is_current_user_admin(): websites = WebSite.all().filter('tags', tagname).order('-created') else: websites = WebSite.all().filter('tags', tagname).filter('is_public', True).order('-created') self.render('tag.html', tag=tagname, websites=websites) else: self.render('base.html', message='No Such Tag')
def get(self, tagname): result = Tag.all().filter('tag', tagname).filter('valid', True) tag = result.fetch(limit=1) if len(tag) > 0: tagname = tag[0].tag if users.is_current_user_admin(): websites = WebSite.all().filter('tags', tagname).order('-created') else: websites = WebSite.all().filter('tags', tagname).filter( 'is_public', True).order('-created') self.render('tag.html', tag=tagname, websites=websites) else: self.render('base.html', message='No Such Tag')
def get(self, ws_id): website = db.get(ws_id) website.is_public=False #invalidate the tags? tags = website.get_tags() newtags = [] for t in tags: if WebSite.all().filter('tags', t).count() > 1: tg = Tag.all().filter('tag',tag).fetch(1) if len(tg)>1: newtags.append(t) if tg[0].entrycount > 0: tg[0].entrycount -= 1 tg[0].put() newtags = [t for t in newtags if t != ' '] website.tags_spc = ' '.join(newtags) website.put() self.render('website.html', website=website)
def get(self, ws_id): website = db.get(ws_id) website.is_public = False #invalidate the tags? tags = website.get_tags() newtags = [] for t in tags: if WebSite.all().filter('tags', t).count() > 1: tg = Tag.all().filter('tag', tag).fetch(1) if len(tg) > 1: newtags.append(t) if tg[0].entrycount > 0: tg[0].entrycount -= 1 tg[0].put() newtags = [t for t in newtags if t != ' '] website.tags_spc = ' '.join(newtags) website.put() self.render('website.html', website=website)