I'm probably missing something blatantly obvious here
chrisramon
How can i catch a NoneType Error, in try: except: ???
JX3
oh fu, typo. sorry
jaddison
chrisramon: NoneType isn't an exception that can be caught.
wenzhixue joined the channel
chrisramon
right the error is AttributeError
sorry
bradleyayers
hi
jaddison
eg. if you try to access an attribute on a variable that is None, it will raise an AttributeError saying something like "AttributeError: 'NoneType' object has no attribute 'blah'"
chrisramon: So you're good now?
chrisramon
yes, thanks mate
jaddison
Rock on.
gbel joined the channel
TIGERBREATH joined the channel
sijin joined the channel
TIGERBREATH
wc
TIGERBREATH has left the channel
feedbackflow joined the channel
feedbackflow
dudes python3 already supported ?
and has anyone tried to use django with tornado ?
JJMalina joined the channel
graingert
feedbackflow: it's not supported
it passes the tests
feedbackflow
graingert: you talking python3 or tornado ? ;]
i like to integrate django, well actually mezzanine into my tornado server stuff
i read 1.5 will have experimental python3 support
guess i need to tickle with the development branche then
is github current ?
johnnny22 joined the channel
joshfinnie joined the channel
czue joined the channel
gbel joined the channel
rideh joined the channel
graingert
feedbackflow: p3
domino14 joined the channel
domino14
don't know where's the right place for this, but i got a django app that is running on several web boxes behind a load balancer
when i deploy to it i would liek to take the box off the load balancer, deploy to it, then put it back on the load balancer, but it still gave me some gateway errors.
reuf joined the channel
w0ng joined the channel
mathesis joined the channel
katsh joined the channel
bluepnume joined the channel
wildfire joined the channel
chrislkeller has left the channel
deadguy1969 has left the channel
pyc0d9r joined the channel
pyc0d9r joined the channel
Cromulent joined the channel
bradleyayers
FunkyBob:
where art thou
pjs
he ran to the store to pickup some vegimite
akcx joined the channel
ustunozgur joined the channel
iiie
domino14: I'd expect that to either be an issue with the load balancer (shouldn't send any connections to a server removed from the pool) or a need to wait for open connections to close (load balancer used a server when it was in the pool and the connection hasn't closed yet)
domino14
iiie: cool. i think it's the second issue, but i do a supervisorctl restart all
i think that waits for the task to end cleanly
maybe not
i dunno (for gunicorn).
iiie
no, supervisor just stops what it's doing
domino14
restart all prints gunicorn:stopped
then a second or two later
gunicorn:started
iiie
gunicorn might be more intelligent if it were the process manager, but supervisor just stops, though you can use different signals for quit, and you can put delays in
jaddison
ewww vegemite - as bad as marmite
phildini joined the channel
iiie
ha, could be chocolate
iiie fully admits he's in the minority
domino14
but supervisor waits until gunicorn is done to stop cleanly i thought
i use it with celery and i see the number of eclery processes going down, but ones that are still busy finish their task
i was under that impression the whole time
then when they are all done it starts again
lacrymology
is there a less ugly way of doing this? http://dpaste.com/807456/ it's just finding that item in the list, and sending it to the bottom
GregMey joined the channel
domino14
ok so supervisor doesn't cleanly restart it
wtf
supervisorctl pid appname | xargs kill -s HUP
Strategist has left the channel
iiie
lacrymology: filter(lambda x:x[0] != 'LocalPickup', shipping_options) + filter(lambda x:x[0] == 'LocalPickup', shipping_options) but this makes two passes
(doesn't do anything if there weren't config changes)
domino14
when it stops them and restarts them, is that clean?
like it will wait until gunicorn is done with its currently procesing tasks
i cant tell
Back2Basics joined the channel
illi-work joined the channel
cyphase joined the channel
iiie
I haven't depended on that in the past, so I couldn't say off hand. I do expect supervisor to wait for the workers to exit cleanly (would be nice, but I haven't expected it -- I didn't remember it from the docs, and don't see it looking now).
hive-mind joined the channel
faldridge joined the channel
There is a stopping process state, so it should wait....
andredieb joined the channel
lacrymology
iiie: makes two passes AND creates three new sequences on the fly
feedbackflow
graingert: thnx for the response
graingert: i'll try to see if i can hook django-dev unto the tornado stuff i have
atula joined the channel
wildfire joined the channel
home joined the channel
jdunck joined the channel
andredieb joined the channel
Oddstr13 joined the channel
makaimc joined the channel
katsh joined the channel
YoMomma joined the channel
nedbat joined the channel
volk_ joined the channel
altipard joined the channel
Oddstr13
is it possible to get the pk innside save() when first saving a Model?
or would my best bet be self.objects.all().order_by("-id")[0] + 1 ?
(or something in that direction)
TIGERBREATH joined the channel
justinzane joined the channel
home joined the channel
jacker224 joined the channel
mindlogger joined the channel
RoboHak joined the channel
Chromablue joined the channel
copyleftdev joined the channel
gbel joined the channel
RoboHak
I just started using django-crispy-forms and they are working out very well, but is there a way to do a DetailView in a similar way?
e.g. auto generated with similar UI (bootstrap)
m00p joined the channel
home
wow
you guys sound like boss
mattmcc
RoboHak: To an extent, that's what the now-deprecated databrowse app was for.
RoboHak
mattmcc: Is there a replacement for it?
mattmcc
Not really. It could still be maintained & updated, but nobody's stepped up to champion it.
bluepnume joined the channel
Back2Basics joined the channel
RoboHak
I did try using a standard form with UneditableFields, but that made it still look like a form
mattmcc
Yeah, forms are not generic UI layout devices.
RoboHak
It seems like I'm missing something obvious. What I'm trying to do is just basic CRUD views with django-crispy-forms
mattmcc
Which part are you missing?
racycle joined the channel
makaimc joined the channel
RoboHak
mattmcc: How to make a generic template for the DetailView that will render the various fields for that object
mattmcc
Yeah, forms aren't designed for that. You could look at how databrowse does it, but it tends to be easier to just make a template per model.
By default, DetailView will look for a template named <model name>_detail.html
RoboHak
I was hoping to avoid needing to change the template every time I change the model
mattmcc
You could write a relatively simple tag to inspect a model for its fields and give them to you in a list.
Part of the reason there isn't much available to automate this is that detail views of objects tend to have very object-specific layout needs.
RoboHak
mattmcc: Have you used django-crispy-forms?
domino14
ok supervisorctl reload or restart all does not kill gunicorn cleanly
RoboHak
I like how it handles layout. I just wish there was something similar for detail views
mattmcc
I used its predecessor django-uni-forms on a couple projects
domino14
i have a view that sleeps for 15 seconds for testing, and then if i run it, then reload gunicorn, it gives me a bad gateway
mattmcc
I don't think it's the right pattern. All it's doing is moving responsibility of the layout definition from templates to forms.