15 messages in com.googlegroups.django-usersordinal not in range(128) + ezPyCrypto
FromSent OnAttachments
elementalMay 13, 2007 4:14 am 
Malcolm TredinnickMay 13, 2007 4:32 am 
elementalMay 13, 2007 5:07 am 
Benjamin SlavinMay 13, 2007 10:55 am 
elementalMay 14, 2007 12:17 am 
elementalMay 14, 2007 1:59 am 
Malcolm TredinnickMay 14, 2007 2:10 am 
elementalMay 14, 2007 2:40 am 
elementalMay 14, 2007 5:01 am 
Benjamin SlavinMay 14, 2007 6:27 am 
Forest BondMay 14, 2007 7:02 am 
Benjamin SlavinMay 14, 2007 7:21 am 
Forest BondMay 14, 2007 8:06 am 
elementalMay 14, 2007 6:33 pm 
Forest BondMay 14, 2007 6:54 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:ordinal not in range(128) + ezPyCryptoActions...
From:elemental (kai.@gmail.com)
Date:May 13, 2007 4:14:50 am
List:com.googlegroups.django-users

I have a small app that needs to store a passport number in a database (MySQL). I'd like to encrypt the passport for security, so I'm using ezPyCrypto. I've never had to encrypt data before so I'm a bit new at this. However, I've worked through a shell and successfully encrypted and decrypted a string. Applying the same logic in my model to my passport string, I get the following error when attempting to save:

UnicodeDecodeError at /register/ 'ascii' codec can't decode byte 0xb4 in position 0: ordinal not in range(128)

For reference, here is the save portion of the model:

def save(self): key = ezPyCrypto.key(512) self.passport = key.encString(self.passport)

I searched for the above error and it seems to be a known bug with newforms (which I'm using). I couldn't find a clear answer to how to work around the problem or if patch has been released.

Unrelated to the error:

Can I simply store a single generated key in my app or must I generate a unique key for each saved object and write the key to a file in a non-public directory? I realize there are different levels of accepted security, but because of the size and scale of this app I'd like to keep things simple if possible. Any advice here would be appreciated.