Skip to content

Instantly share code, notes, and snippets.

@sivy
Created November 9, 2012 14:23
Show Gist options
  • Save sivy/4045969 to your computer and use it in GitHub Desktop.
Save sivy/4045969 to your computer and use it in GitHub Desktop.
def sync_templates(client, uid, template_name=None):
templates = UserTemplate.query()
for t in templates.iter():
if not template_name or t.name == template_name:
try:
tresp, meta = client.get_file_and_metadata(
"/templates/" + t.name)
t.content = tresp.content.decode('utf8')
t.put()
except: # template doesn't exist for new users sometimes
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment