2009-7-6
| 23:14 | gordonjcp | if you don't know Python you might not get much out of it, but tbh you'll soon pick it up |
| 23:14 | Bacon | wouldn't it be better for me to look at a turorial for Python itself first |
| 23:14 | rozwell | the python docs has a tutorial |
| 23:14 | mattmcc | Certainly couldn't hurt. |
| 23:15 | rozwell | and the django docs has a tutorial |
| 23:15 | uzi | Bacon: sure... and the python website has a tutorial as well |
| 23:15 | rozwell | tutorials all around |
| 23:15 | billly | |
| 23:15 | Bacon | I could probaby understand django's though |
| 23:15 | mattmcc | The official Python docs have a tutorial. And if you're already familiar with another language, there's diveintopython. |
| 23:15 | Bacon | I find reading code, even languages I don't know ... usually pretty easy |
| 23:17 | jayzer | yea, diveintopython.org is a pretty decent intro to the language |
| 23:18 | Finder | hey all, is there an easy way to get a notice of when a specific field has changed in a model? |
| 23:19 | mattmcc | Not really. |
| 23:19 | Finder | ok, thanks |
| 23:20 | Finder | oh, I guess I can wrap save() and use self._modified_attrs |
| 23:20 | Finder | thanks |
| 23:22 | davos | hi guys, i was hoping someone might be able to point me in the right direction |
| 23:22 | mattmcc | Use what? |
| 23:22 | davos | my request.session.session_key changes every page load |
| 23:22 | andym_ | wrapping save or using a signal is what you'd do to detect changes, but not sure about _modified_attrs, whats that? |
| 23:22 | Finder | _modified_attrs appears to be a list of strings with attribute names that have changed |
| 23:22 | davos | i have 'django.contrib.sessions.middleware.SessionMiddleware' in middleware, and 'django.contrib.sessions' in INSTALLED_APPS |
| 23:22 | andym_ | Finder: not in my django source |
| 23:22 | Finder | really? |
| 23:23 | andym_ | where is it in yours? |
| 23:23 | Finder | yeah, you're right, sorry |
| 23:23 | Finder | it's a custom meta class. :-/ |
| 23:23 | davos | it doesn't appear to save a cookie for some reason... but if i go to the login page of django-registration the cookie is set |
| 23:24 | davos | is there something app-specific i should do to make sure the cookie is set? |
| 23:24 | Finder | davos: what happens when you do this? http://docs.djangoproject.com/en/dev/topics/htt... |
| 23:25 | davos | ah thanks, i'll try now |
| 23:25 | mariano|syzygy | is there a way to write an app using django as infrastructure but, say, a UI built using gtk so as to have a desktop app? |
| 23:25 | dang`r`us | sure, wire em up e.g. with json |
| 23:26 | mariano|syzygy | ah |
| 23:27 | davos | Finder: hmmm 'Please enable cookies and try again.' |
| 23:27 | davos | i'll try a different browser |
| 23:27 | davos | yeah same in safari |
| 23:28 | davos | Finder: this is what i'm trying http://dpaste.com/63919/ |
| 23:28 | Finder | what happens? |
| 23:29 | davos | it outputs ''Please enable cookies and try again.'' |
| 23:30 | Finder | I think you're missing set_test_cookie() |
| 23:30 | davos | doh |
| 23:31 | davos | thanks, i'll try that |
| 23:31 | Finder | you can do it across multiple pages, have one view that sets it and another that tests it |
| 23:32 | davos | hmmm yeah that works, it sets the cookie fine |
| 23:32 | Finder | ok, there's some problem in your other logic then, the session middleware is installed and working |
| 23:32 | Finder | how are you trying to use it? |
| 23:34 | davos | i've got a cart-style thing where products are added to the cart by session_key |
| 23:34 | davos | it's on app-engine, so cart stuff is stored in the data store |
| 23:34 | davos | it adds to the cart ok, but since session_key changes every time they keep dissapearing |
| 23:35 | Finder | you can make your own key and assign it to request.session |
| 23:35 | davos | i've found out that the cookie isn't set for 2 of the apps |
| 23:35 | Finder | |
| 23:35 | Finder | I typically use uuid.uuid4() to create keys, and that way they don't actually have any access to the key itself |
| 23:36 | davos | ah so i have to actually physically add something to the session to force it to create the cookie? |
| 23:36 | Finder | not sure about that, but the sessions is more intended as a cross-session dicrt |
| 23:36 | Finder | dict* |
| 23:37 | davos | ok, this is all making more sense |
| 23:37 | davos | thanks a lot for your time/help!! |
| 23:37 | davos | much appreciated |
| 23:38 | Finder | np, take a look at the exampels at http://docs.djangoproject.com/en/dev/topics/htt... for more precise infpo |
| 23:38 | Finder | geeze I can't spell, but you know what I mean |
| 23:38 | dang`r`us restarts Finder | |
| 23:38 | Finder | thanks! |
| 23:39 | davos | cheers! |
| 23:45 | russell_h | does one need to do anything special to override an object's __iter__ method? |
| 23:46 | russell_h | specifically in a ModelChoiceIterator |
| 23:46 | andym_ | i would be surprised if you did |
| 23:48 | russell_h | for some reason my __iter__ never gets called: http://dpaste.com/63923/ |
| 23:50 | russell_h | oh... I bet I know the reason. |
| 23:51 | davos | Finder: yep it was in the doc, 'To change this default behavior, set the SESSION_SAVE_EVERY_REQUEST setting to True' |
| 23:51 | davos | thanks again! |
| 23:51 | drkfiber | aAafu90 |
| 23:52 | drkfiber | sorry, cleaning keyboard. |
Page 22 of 22
← Previous
(2,175 total)