Created
September 1, 2014 18:53
-
-
Save aaronlelevier/c98f367ac6e3846e81cb to your computer and use it in GitHub Desktop.
This file contains 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
# ---------------------------- None View Helper Functions ------------------------------------ | |
# Place to save image upload file | |
def handle_uploaded_file(f): | |
with open(content_file_name(f), 'wb+') as destination: | |
for chunk in f.chunks(): | |
destination.write(chunk) | |
# Attempt Imagefield | |
def content_file_name(instance, filename): | |
return '/'.join([filename]) | |
def newPassword(): | |
a = random.randrange(97,122) | |
b = random.randrange(5,122,7) | |
c = random.randrange(97,122) | |
d = random.randrange(7,122,6) | |
e = random.randrange(97,122) | |
return str(chr(a)) + str(ord(chr(b))) + str(chr(c)) + str(ord(chr(d))) + str(chr(e)) | |
# Helper function to look up Book Obj. using display_url | |
def uncode_display_url(book_id): | |
book = book_id.split('-') | |
ans = ' '.join(book) | |
return ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment