#django

/

      • Karial has quit
      • polydaic
        yo
      • django binary field are somehow corrupting my
      • encrypted bytearrays
      • jmckind has quit
      • rge1 has quit
      • 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
      • elbaschid has quit
      • polydaic
        rando305:
      • rando305: gist.github.com
      • rando305
      • kuter
        i've no access to pg_hba.conf
      • polydaic
        rando305: copy paste the problem section to gist.github.com
      • make a new gist
      • elbaschid joined the channel
      • and then share the link
      • kuter
        postgres is on the same host
      • polydaic
        kushal:
      • kuter: hmm?
      • why not
      • are you on a PaaS?
      • apollo13
        polydaic: you are using mysql right?
      • polydaic
        apollo13: yep
      • apollo13
        surprise surprise
      • adrian1 joined the channel
      • rando305
      • kuter
        polydaic: because it is restricted.
      • apollo13
        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?
      • first link for "django python 3" on google https://docs.djangoproject.com/en/1.7/topics/py...
      • sometimes I really wonder what people search for
      • rando305
        ok. I'll look there.
      • I was thinking it was more a python thing that django. I didn't put django in the search.
      • Hairy joined the channel
      • I will
      • apollo13
        ok, for the next time assume that when I say "django docs" I actually mean them for a reason
      • rando305
        This was actually the link I used a week or so ago to convert to 3.
      • Thanks for resending me there. It looks like they have a decorator that fixes things.
      • apollo13
        yes we do ;)
      • polydaic
        apollo13: hmm
      • apollo13
        polydaic: mhm?
      • polydaic
        it seems like mysql is trucanting
      • and like
      • idk bitshifting?
      • they don’t match up
      • bkuberek joined the channel
      • its removing ilke 10 bytes
      • apollo13
        so as much as I hate mysql I'd be surprised about shifting
      • polydaic
        apollo13: how do i prevent this
      • other than moving to postgres
      • jonmorehouse has quit
      • rando305
        Sorry apollo13 - I didn't realize that 'they' was 'you'! :-)
      • polydaic
        at least the truncating part
      • ghosticus
        increase your column's length/size?
      • __machine has left the channel
      • polydaic
        ghosticus: its not doing it at a fixed spot
      • unknwn- has quit
      • ojh joined the channel
      • apollo13
        polydaic: dunno, #mysql probably knows how you can configure mysql to error out instead of truncating
      • polydaic: does it fail at nullbytes?