def acquire_marker(identifier): identifier_key = Key.from_path(UniqueMarker.kind(), identifier) marker = UniqueMarker.get(identifier_key) if marker: #If the marker instance is None, and the marker is older then 5 seconds then we wipe it out #and assume that it's stale. if not marker.instance and (datetime.datetime.utcnow() - marker.created).seconds > 5: marker.delete() elif marker.instance and Key( marker.instance) != entity_key and key_exists( Key(marker.instance)): raise IntegrityError("Unable to acquire marker for %s" % identifier) else: #The marker is ours anyway return marker marker = UniqueMarker( key=identifier_key, instance=str(entity_key) if entity_key.id_or_name() else None, #May be None if unsaved created=datetime.datetime.utcnow()) marker.put() return marker
def get(self): key = Key(self.request.get('id')) cell = db.get(key) self.response.out.write( json.dumps({ 'status': cell.status, 'output': cell.output }))
def validateRequest(request, page): from google.appengine.api.datastore import Key try: token = accesstoken.all().filter('__key__ =', Key(request.get('a'))) except: return False if token.count() > 0: token = token.get() if simplr.extract(token.url, 'as2df4gh78jklqweo1iu') == page: token.delete() return True else: return False else: return False
def get(self): key = Key(self.request.get('id')) cell = db.get(key) self.response.out.write(json.dumps({'exec_string': cell.exec_string}))