def get(self,format="json"): url = self.request.get('url') if url.find("http://") != -1 or url.find("https://") != -1: simplewebapp.formatResponse(format, self, getTagsForUrl(url)) else: simplewebapp.formatResponse(format, self, "FAILED")
def executeSave(self, format): tagname = self.request.get("tagname").lower() tags = self.request.get("tags").split(" ") owner = self.request.get("owner").lower() if saveTagMismatch(tagname, tags, owner): simplewebapp.formatResponse(format, self, "OK") else: simplewebapp.formatResponse(format, self, "FAILED")
def get(self, format="json"): results = [] tagsRaw = getTagTerms(self.request.get("q").lower()) if len(tagsRaw) == 0 or tagsRaw[0] == "": simplewebapp.formatResponse(format, self, results) return entries = Entry.all().filter("tagsRaw IN ", tagsRaw).run() results = findEntries(entries, tagsRaw) simplewebapp.formatResponse(format, self, results)
def get(self,format): tags = Tag.all().run() db.delete(tags) firstLevelTags = [ "ActionScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme", "haxe", "nodejs", 'framework', 'tool', 'wiki', 'tutorial', 'howto', 'library', 'service', 'language' ] for tag in firstLevelTags: t = Tag(name=tag.lower()) t.put() entries = Entry.all() for e in entries: newtags = getTagKeys(e.tagsRaw) e.tags = newtags e.put() simplewebapp.formatResponse(format, self, "OK")
def get(self, format="json"): results = [] tagsRaw = getTagTerms(self.request.get("q").lower()) if len(tagsRaw) == 0 or tagsRaw[0] == "": simplewebapp.formatResponse(format, self, results) return # EXTREMELY SLOW ! OPTIMIZE! entries = Entry.all().order("-updatedAt").run() results = findEntries(entries, tagsRaw) simplewebapp.formatResponse(format, self, results)
def get(self,format="json"): query = self.request.get("q").lower() if len(query) == 0: simplewebapp.formatResponse(format,self,[]) return resultedTags = [] tags = TagModel.all().run() for tag in tags: if tag.name.startswith(query): resultedTags.append(tag.name) simplewebapp.formatResponse(format,self,resultedTags)
def get(self,format): url = self.request.get("url").lower() try: content = resource.get(url).decodeBody().lower() except: content = "" tags = JSONDecoder().decode(content); ''' appends only new tags ''' newTags = [] for tag in tags: t = None t = Tag.all().filter("name = ", tag).fetch(1) if len(t) == 0: newTag = saveTag(tag, None); newTags.append(newTag.name) simplewebapp.formatResponse(format, self, newTags)
def executeSave(self, format): url = self.request.get("url").lower() if url.find("http://") == -1 and url.find("https://") == -1: simplewebapp.formatResponse(format, self, "FAILED") return tags = getTagTerms(self.request.get("tags").lower()) owner = self.request.get("owner").lower() source = self.request.get("source").lower() if saveEntry(url, source, owner, tags): simplewebapp.formatResponse(format, self, "OK") else: simplewebapp.formatResponse(format, self, "FAILED")
def get(self, ownerUID, format="json"): if len(ownerUID) == 0: simplewebapp.formatResponse(format, self, "FAILED") return o = Owner.all().filter("uid =", ownerUID).fetch(1) if len(o) != 1: simplewebapp.formatResponse(format, self, "FAILED") return owner = o[0] q = self.request.get("q").lower() # VEERY SLOW ! OPTIMIZE! ownEntries = db.GqlQuery("SELECT * FROM Entry WHERE owners = :1", owner).run() tagsRaw = getTagTerms(q) results = [] if len(q) != 0: results = findEntries(ownEntries, tagsRaw) simplewebapp.formatResponse(format, self, results)
def get(self,format='json'): simplewebapp.formatResponse(format, self, getTags())