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)
def post(self): author = users.get_current_user() title = escape(self.request.get("title")) link = escape(self.request.get("link")) description = escape(self.request.get("description")) tagsrc = self.request.get("tagsrc") srclink = escape(self.request.get("srclink")) deschtml = markdown2.markdown(description) tags = tagsrc.split(' ') ws = WebSite(author=author, title=title, link=link, description=description, srclink=srclink, is_public=False, deschtml=deschtml) ws.update_screencap() ws.tags_spc = tagsrc ws.save() self.render('submit_success.html')
def get(self): websites = WebSite.gql('WHERE is_public=False ORDER BY created ') self.render('reviewsites.html', websites=websites)
def get(self, userid): websites = WebSite.gql('WHERE is_public=True and author=:1 ORDER BY created DESC ', userid) self.render('userprofile.html', websites=websites)
def get(self): websites = WebSite.gql('WHERE is_public=True ORDER BY created ') self.render('with-source.html')
def get(self): websites = WebSite.gql('WHERE is_public=True ORDER BY votes DESC LIMIT 5') self.render('highest-rated.html', websites=websites)
def get(self): websites = WebSite.gql('WHERE is_public=True ORDER BY created DESC') self.render('index.html', websites=websites)
def get(self, userid): websites = WebSite.gql( 'WHERE is_public=True and author=:1 ORDER BY created DESC ', userid) self.render('userprofile.html', websites=websites)
def get(self): websites = WebSite.gql( 'WHERE is_public=True ORDER BY votes DESC LIMIT 5') self.render('highest-rated.html', websites=websites)