Created
November 9, 2012 14:23
-
-
Save sivy/4045969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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