

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
15 messages in com.googlegroups.django-usersRe: ordinal not in range(128) + ezPyC...| From | Sent On | Attachments |
|---|---|---|
| elemental | May 13, 2007 4:14 am | |
| Malcolm Tredinnick | May 13, 2007 4:32 am | |
| elemental | May 13, 2007 5:07 am | |
| Benjamin Slavin | May 13, 2007 10:55 am | |
| elemental | May 14, 2007 12:17 am | |
| elemental | May 14, 2007 1:59 am | |
| Malcolm Tredinnick | May 14, 2007 2:10 am | |
| elemental | May 14, 2007 2:40 am | |
| elemental | May 14, 2007 5:01 am | |
| Benjamin Slavin | May 14, 2007 6:27 am | |
| Forest Bond | May 14, 2007 7:02 am | |
| Benjamin Slavin | May 14, 2007 7:21 am | |
| Forest Bond | May 14, 2007 8:06 am | |
| elemental | May 14, 2007 6:33 pm | |
| Forest Bond | May 14, 2007 6:54 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread 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) + ezPyCrypto | Actions... |
|---|---|---|
| From: | elemental (kai....@gmail.com) | |
| Date: | May 14, 2007 2:40:30 am | |
| List: | com.googlegroups.django-users | |
Hi Malcom,
I was unaware of sys.stderr.write, very handy--thanks (obviously, I'm still working my way through python/django).
I'm indeed on the development server, and using sys.stderr.write, I can conclude that:
- the key is being imported from the settings file - self.passport contains the encrypted passport
The problem seems to lie in :
return(k.decString(self.passport))
as nothing is printed in the console with sys.stderr.write(k.decString(self.passport).
Also, I'm not sure what I would actually input to test if k.importKey(secret_key) is gathering info, so the problem may be there.
secret_key = settings.SECRET_KEY k = ezPyCrypto.key() k.importKey(secret_key)
sys.stderr.write(k)
This doesn't print anything to the console, but it also doesn't seem as if it should print anything. Ideas? Sorry to keep pestering, but there's a mental bridge I haven't quite crossed yet in terms of how this is all working together. Thanks again.
On May 14, 5:11 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote:
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:
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







