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



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to