def handle(self, *args, **options): # Login self.authorize(options) # Loop through them... for obj in Document.all(): # ... and do the deed. print "Deleted %s" % obj obj.delete()
def get(self): # Check if the key exists as an object in the db obj = get_key_or_none(self.request) # If it does... if obj: # ..update connected docs obj.similar_documents = obj.get_similar_documents() obj.put() # And then grab them all similar_documents = db.get(obj.similar_documents) # Otherwise just grab the ones currently linked to them else: key = db.Key(self.request.get("key", None)) similar_documents = Document.all().filter("similar_documents =", key) # Then loop through and update all of them. for doc in similar_documents: doc.similar_documents = doc.get_similar_documents() logging.debug("Updated similar documents for %s" % doc) doc.put() # Close out self.response.out.write("OK")
def get(self): # Check if the key exists as an object in the db obj = get_key_or_none(self.request) # If it does... if obj: # ..update connected docs obj.similar_documents = obj.get_similar_documents() obj.put() # And then grab them all similar_documents = db.get(obj.similar_documents) # Otherwise just grab the ones currently linked to them else: key = db.Key(self.request.get('key', None)) similar_documents = Document.all().filter("similar_documents =", key) # Then loop through and update all of them. for doc in similar_documents: doc.similar_documents = doc.get_similar_documents() logging.debug("Updated similar documents for %s" % doc) doc.put() # Close out self.response.out.write('OK')
def items(self): return Document.all().filter("is_published =", True).order("-publication_date")[:10]