15 messages in com.googlegroups.django-usersRe: ordinal not in range(128) + ezPyC...
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:Re: ordinal not in range(128) + ezPyCryptoActions...
From:Malcolm Tredinnick (malc@pointy-stick.com)
Date:May 14, 2007 2:10:47 am
List:com.googlegroups.django-users

On Mon, 2007-05-14 at 08:59 +0000, elemental wrote:

Update...

I think I've fixed the insert issue. The updated model is here:

http://dpaste.com/10264/

Now, I just can't get the passport back out of the database :-)

I put together a quick view/template, and the passport is being returned as an empty string, with no errors.

The relavent part of the the model is:

def get_passport(self): secret_key = settings.SECRET_KEY k = ezPyCrypto.key() k.importKey(secret_key)

return(k.decString(self.passport))

decryptedPP = property(get_passport)

My view is really short, so I'll just post it here:

def list(request):

registrations = registerDiver.objects.all()

return render_to_response('list.html', { 'registrations' : registrations, }, context_instance=RequestContext(request))

and my template:

<ul> {% for diver in registrations %} <li>{{ diver.first_name }} | {{ diver.decryptedPP }}</li> {% endfor %} </ul>

Any ideas why decryptedPP is blank?

Put some diagnostic output into get_passport() to see if it (a) gets called and (b) extracts the information you think it should be.

You can print to sys.stderr, for example, and the result will show up on the console (if you are using the development server) or in Apache's error log (if you are using mod_python -- although remember to call sys.stderr.flush() in that case because mod_python buffers stderr) or somewhere if you are using another webserver. Typically, though, sys.stderr should go somewhere sensible.

Drop in a print statement to see if you call the method. Drop in another one to see if k.importKey() actually gathers any information. Does self.passport contain something? Does k.decString() do anything with that something or perhaps raise an exception? Not until you know that get_passport() is returning the right value will you be in a position to work out why the template isn't displaying that value.

Regards, Malcolm