-
Notifications
You must be signed in to change notification settings - Fork 0
PubMed On Steroids (Google App Engine application)
marcora/pubmedos-gae
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
class Recipe(db.Model): text = db.TextProperty() owner = db.UserProperty() def put(self): if not self.owner: self.owner = users.get_current_user() return db.Model.put(self) def get_by_key_name(cls, key_name, parent=None): entity = super(Recipe, cls).get_by_key_name(key_name, parent) if entity.owner != users.get_current_user(): raise Exception("Access denied") return entity # Set the owner automatically r = Recipe(key_name="secret sauce") r.text = "ketchup and mayonnaise" r.put() # Only allow the owner to get the record r = Recipe.get_by_key_name("secret sauce") ==================================================================== See http://fi.am/entry/urlsafe-base64-encodingdecoding-in-two-lines/ You can do this using Python's built-in base64 library in just two lines of code: import base64 def uri_b64encode(s): return base64.urlsafe_b64encode(s).strip('=') def uri_b64decode(s): return base64.urlsafe_b64decode(s + '=' * (len(s) % 4))
About
PubMed On Steroids (Google App Engine application)
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published