Added comments documenting some methods

This commit is contained in:
Roberto Rosario
2011-05-30 22:59:14 -04:00
parent 39da4d2e6b
commit 12d3ec4ed5
2 changed files with 41 additions and 1 deletions
+12
View File
@@ -69,6 +69,10 @@ class StagingFile(object):
@classmethod
def get_all(cls):
"""
Return a list of StagingFile instances corresponding to the
current path
"""
staging_files = []
for filename in get_all_files(cls.path):
staging_files.append(StagingFile(
@@ -78,6 +82,10 @@ class StagingFile(object):
@classmethod
def get(cls, id):
"""
Return a single StagingFile instance corresponding to the id
given as argument
"""
files_dict = dict([(file.id, file) for file in cls.get_all()])
if id in files_dict:
return files_dict[id]
@@ -102,6 +110,10 @@ class StagingFile(object):
raise AttributeError
def upload(self):
"""
Return a StagingFile encapsulated in a File class instance to
allow for easier upload a staging files
"""
try:
return File(file(self.filepath, 'rb'), name=self.filename)
except Exception, exc: