changeset 55:b7ef29e851b4

Added documentation.
author Atul Varma <varmaa@toolness.com>
date Wed, 05 Mar 2008 09:48:30 -0600
parents f19c2a2987cc
children 4108a1d30e36
files PersonasBackend/personas/views.py
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/PersonasBackend/personas/views.py	Wed Mar 05 09:37:45 2008 -0600
+++ b/PersonasBackend/personas/views.py	Wed Mar 05 09:48:30 2008 -0600
@@ -31,7 +31,17 @@
         context_instance = RequestContext(request)
         )
 
-def _rename_file( filedict, persona ):
+def _rename_file( filedict, persona=None ):
+    """
+    Attempts to find a better name for an uploaded persona image
+    represented by the given HttpRequest file info dictionary and an
+    optional models.Persona object.
+
+    Uploaded files are named by the submitter, and could have names
+    that are completely meaningless to us, so we want to try to rename
+    them to something that makes more sense to us.
+    """
+
     import os
     import time
 
@@ -39,7 +49,9 @@
     # file after the commit is made or something.
 
     origExt = os.path.splitext( filedict["filename"] )[1]
-    # TODO: Normalize origExt somehow?
+
+    # TODO: Normalize/validate origExt somehow?
+
     if persona:
         filename = "persona_%d_rev_%d%s" % (
             persona.id,