Skip to content

Commit

Permalink
[ALL] Convert SHA to hex in DP filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
jonte committed Nov 21, 2009
1 parent 07e63e1 commit 82ff3bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions amsn2/backend/defaultaccountbackend.py
Expand Up @@ -170,12 +170,16 @@ def removeAccount(self, email):
os.rmdir(os.path.join(root, subdir))
os.rmdir(accdir)

""" DPs """
"""
Get location of display picture. A SHA sum is included in the filename,
this is converted to hex.
@return: string with filename.
"""
def getFileLocationDP(self, email, uid, shac):
dir = os.path.join(self.dps_dir, self._getDir(email))
if not os.path.isdir(dir):
os.makedirs(dir, 0700)
return os.path.join(dir, shac+".img")
return os.path.join(dir, shac.encode("hex")+".img")

def _getDir(self, email):
return email.lower().strip().replace("@","_at_")

0 comments on commit 82ff3bf

Please sign in to comment.