Is there another field i should be using other than binaryfields to store this data?
acangiani has quit
apollo13
the BinaryField is just fine, your code is probably doing something bad
colinbits joined the channel
and even if not, you should try to figure out what is wrong instead of switching to something else
rando305
I'm having a unicode problem. I'm trying to put all my data in unicode - but there are parts of the django/admin function that seem to be trying to force things to str - and crashing.
tbaxter has quit
apollo13
rando305: I strongly doubt that
polydaic
apollo13: i’ve checked teh encrypt and decrypt functions in teh django shell
they work fine
apollo13
polydaic: aha
mysteryjeans has quit
polydaic
just with variables
i’m getting the error because the expected digest is not equal to the actual digest
whatever that means
apollo13
please see the topic…
rando305
When I try to delete an entry in /admin - and it is trying to pull up all the dependencies, it crashes. Even though I can look at the student, edit and delete the unicode stuff.
apollo13
rando305: please see the topic
elbaschid has quit
polydaic
rando305: post your code
elbaschid joined the channel
apollo13: anyways my encryption and decryption functions work great. I’ve got them working fine in other parts of the code
SuperLag has quit
SuperLag joined the channel
the only thing different here is that i’m storing the keys in the binary fields
and retrieving them
apollo13
why waste my time instead of doing what the topic asks? :(
elbaschi_ joined the channel
rando305
polydaic - I switched readers. What is the best way to do a gist? I'm on a ubuntu machine. Thanks
polydaic
hmm
maybe it is because the binary field has a default length
kuter
i've got problem with psycopg2 and django .. when i'm trying to run dbshell postgres ask me for password
rando305: we need the traceback, not just the error
polydaic
so its using VARBINARY
hmm
apollo13
polydaic: that is not what I ment, but if a database silently truncates data it is mysql :þ
polydaic
which is 8k bytes long
apollo13
in postgres that would have been an error…
jessamynsmith has quit
prettiestPony11 joined the channel
rando305
It says ascii codec can't encode '...' - but I didn't ask for ascii anywhere. This is all the django/admin code.
apollo13
or not cause it supports more than 8k most likely
rando305: …
DLSteve has quit
elbaschi_ has quit
rando305
- ok - I think I know what the problem is. I was trying to convert to Python 3. Went from __unicode__ back to __str__. Is there a way to future proof my code?
murk has quit
(when I actually can go to Python 3)?
apollo13
yes, read the django docs about writing py2 & py3 compatible code
mantovani has quit
govg has quit
elbaschid has quit
rando305
yes - I had. But I don't understand the def __unicode__() - back to __str__(). The string doesn't work in Python 2
apollo13
as I said before, show the code in question and the ______full_____ traceback
Technodrome has quit
brntn has quit
rando305
Well the code in question is in admin. But I'll look at fixing my __str__ declarations to something that won't force ascii.
apollo13
*sigh*
jazzzu joined the channel
brntn joined the channel
with code I ment __your__ code, it is not the admin causing the problem even though it triggers it, the problem is still in your code
polydaic
apollo13: wait yea
__machine joined the channel
the size of my pk went from 3279 to 64
hmm
rando305
yes - I posted my github. I expect that it is in the string definitions (I used to have them as __unicode__ ) and didn't switch them back. I'm looking now to see how to do something that will work for 2 and 3
underthehill has quit
apollo13
rando305: you posted the error, not the traceback
elbaschid joined the channel
rando305
ok - I've updated the gist
lacrymology joined the channel
lacrymology has quit
Harlin joined the channel
juztin has quit
I guess just go back and replace all the __str__ back to __unicode__ and then switch back - the alternative looks like a bit of a hack.
apollo13
or you just read the django docs on how to support both at the same time?!
I really don't see any hacks there…
juztin joined the channel
doughj3
if i have a dict in my template, and I want to get the value for a key (which in this case is a string), I can do {{ dict.key }}. What if the key has a space in it?
apollo13
most likely not without a custom filter
doughj3
Figured. No problem, thanks
teebes has quit
krisf has quit
rando305
yeah - told me to write a function that behaved differently based on the system configuration. It would require that all my u".." commands be replaced with u(..). It probably wasn't going to fix the __str__ declarations in my models - which was why admin was crashing.
apollo13
rando305: uhm, wait -- which docs exactly are you reading?
django docs hopefully don't tell you to use u()
Technodrome joined the channel
rando305
But django is still true. Replaced the __str__ declarations back to __unicode__ and everything works again. I'll have to switch it all back when I can migrate to 3.
elbaschid has quit
apollo13
*sigh*
seriously, you haven't been listening to anything I say
rando305
Yes - but I've been working at the same time. Do you have a specific link. I just went to the first one that came up. It probably wasn't the best.
apollo13
I told you to look at the django docs, how hard can it be to find a link there?