2008-7-25
| 05:11 | forsaken | is it a known bug that calling runserver with call_command makes the code calling it execute twice? (atleast for my management command) |
| 05:12 | forsaken | unless i'm doing something wrong |
| 05:13 | SmileyChris | forsaken: i experience that with django_evolution, so I guess it's a bug |
| 05:13 | SmileyChris | whether it has been properly reported, i know not |
| 05:13 | forsaken | hrm, okay |
| 05:13 | forsaken | it's happening for me as well |
| 05:13 | forsaken | so it must be a bug |
| 05:19 | forsaken | SmileyChris, have you looked into it at all? or found a workaround? |
| 05:19 | SmileyChris | forsaken: had a quick look but didn't solve it |
| 05:20 | forsaken | only happens with runserver, and the runserver inner loop only gets executed once, but yea, i couldn't find anything beyond that |
| 05:20 | SmileyChris | actually, my case isn't identical |
| 05:21 | forsaken | state isn't maintained between runs |
| 05:21 | forsaken | hrm |
| 05:21 | SmileyChris | |
| 05:21 | SmileyChris | there's the example of the behaviour i'm experiencing |
| 05:21 | SmileyChris | running "evolve" works fine (ie only runs once) |
| 05:22 | SmileyChris | dj is an alias there, btw |
| 05:22 | forsaken | mine: http://dpaste.com/67344/ |
| 05:23 | SmileyChris | forsaken: so, similar |
| 05:23 | SmileyChris | forsaken: seems to be something about signal registration? |
| 05:23 | forsaken | yea |
| 05:23 | forsaken | not sure really |
| 05:23 | forsaken | this is my first foray into much django devel |
| 05:23 | SmileyChris | that's what evolution is using there |
| 05:23 | SmileyChris | i'm guessing so are you |
| 05:24 | forsaken | mine isn't using any signals |
| 05:24 | SmileyChris | oh? |
| 05:24 | forsaken | just calling call_command('runserver') |
| 05:24 | forsaken | and its re-evaluating the containing file |
| 05:24 | SmileyChris | which only gets called once... |
| 05:24 | forsaken | yea, but there's code before and after the call that gets run twice |
| 05:24 | SmileyChris | odd |
| 05:24 | forsaken | the code before runs twice before the server runs, then the code after runs twice after the server runs |
| 05:25 | SmileyChris | sorry I can't be more help |
| 05:25 | forsaken | no worries |
| 05:25 | forsaken | i'm not doing anything super important :) |
| 05:25 | forsaken | its just odd |
| 05:25 | SmileyChris | agreed |
| 05:26 | SmileyChris | bring it up on the dev group |
| 05:28 | forsaken | yea |
| 13:54 | reppel | Hi, is there a reason why signals.post_save is triggered twice for each save? |
| 18:38 | ericholscher | empty, in your command extensions stuff, did you ever try to call call_command('runserver')? |
| 18:39 | ericholscher | i see you are copying the code out of runserver instead, i guess because your changing the internals? |
| 21:14 | remo | I just discussed an issue with many_to_many relationships on #django. assume ive got a 'Survey' model with participants = m2m(User). On creation of the model (e.g. admin interface), i'd like to send each user an email automatically. the trouble is, hooking in post_save does not work, as 'participants' is not populated yet. |
| 21:15 | remo | One way to go about that would be to move the relation to User |
| 21:16 | remo | but in this case, that would be difficult |
| 21:16 | Alex_Gaynor | remo: Would creating the intermediary model yourself and than setting up a post_save signal on that work? |
| 21:16 | Alex_Gaynor | If so, #6095 is very close to being committed, perhaps you could test the patch |
| 21:16 | DjangoBot | |
| 21:18 | remo | ah yes, that sounds good |
| 21:19 | remo | thanks :) |
| 22:03 | remo | Hi guys, I'd like to discuss #6095. Consider following use-case: I've got a Survey model with Survey.participants = m2m(User), and i want to notify each participant when a survey is created. Now, with the patch, I could define an intermediary model, and hook into its post_save signal to send those messages. |
| 22:04 | DjangoBot | |
| 22:04 | remo | The thing is, defining an intermediary model breaks the admin interface (as participants.add(), .create() etc are blocked). To get an interface like 'filter_horizontal', I'd have to cook up a lot of code. |
| 22:04 | remo | So, how about we only block the managers .add, .create etc. if the intermediary model defines more fields than the two ForeignKeys? This would allow to hook into the changes of a m2m relation without negative consequences. |
| 22:10 | brosner | remo: what is the point? why just use an m2m without through specified? |
| 22:11 | brosner reading your first message, my bad ;) | |
| 22:12 | brosner | oh i think your getting at a completely different issue. |
| 22:12 | brosner | that seems like it would be a good side-affect from 6095 |
| 22:13 | remo | yeah. although hacking the manager to vary on the intermediate model sounds.. hacky ;) |
| 22:14 | remo | so how would we go about this? |
| 22:14 | brosner | there is an issue in trac that describes adding signals in m2m fields. not sure exactly about its details or whether it would even fix your problem, but sounds more like the correct route. |
| 22:15 | brosner | and of course, i may be off base and your way actually might even be a better use case but not nearly good enough to block it ;) |
| 22:16 | remo | #6778 really is more reasonable |
| 22:16 | DjangoBot | |
| 22:17 | brosner | yeah that is what i was referring to. |
| 22:17 | remo | as signals is all about hooking in code |
| 22:17 | remo | ok, i'll see about a patch |
| 22:17 | brosner | cool |
| 22:25 | lsoto | hello django devs |
| 22:25 | lsoto | do you think that #7560 has a chance to be reviewed on the next week? |
| 22:25 | DjangoBot | |
| 22:27 | lsoto | that seems to be the only blocker for Django/Jython and would allow me to start writing docs about how to use django with jython, without having to patch anything |
| 22:29 | remo | so, how do we call those signals? m2m_post_save? and the sender would be the relations manager? |
| 22:31 | remo | we could also stick with the stock signals |
| 22:55 | Gulopine1 | ugh |
| 22:55 | Gulopine1 | i forgot about the stupid cull_percentage thing |
| 22:55 | Gulopine1 | $%#$! |
| 22:55 | Gulopine | better |
| 22:55 | Gulopine | if it's calculated as 1/cull_percentage, it's not a percentage :( |