| kezabelle | a lot of which should be cachable |
| steve_j | we have a head of cacheing in place, yeah |
| steve_j | it's just hard to know if the session updating will a) just form an orderly queue and get on wiht it or b) cause a fight |
| mksoft | terrasque: No way I could have guessed that :-) |
| steve_j | hence why a super-facst sessionstore would be handy. |
| steve_j | i've seen http://github.com/ericflo/django-tokyo-sessions which looks interesting but has a ticket open on it |
| jtiai | steve_j: what's wrong with memcache? |
| steve_j | jtiai non-persistent, that's all |
| steve_j | otherwise fine |
| steve_j | we're already using cached_db sessions |
| jtiai | steve_j: as a writetrough? |
| steve_j | yeah |
| steve_j | tho i noticed that we're saving the session on every request, for some reason |
| steve_j | hmmn |
| steve_j | is the session timestamp updated on every request anyway? |
| jtiai | steve_j: Nope. Expiration is only changed when contents of session is changed. |
| steve_j | eg: login, or specific parking of something in the session |
| jtiai | steve_j: Why there exists this saving on every request to keep timestamps running. |
| steve_j | i'm nto sure |
| steve_j | i thikn it was originally put in place to force the creation of a session if the client is logging in with no existing session (ie cookieless client) |
| steve_j | we may not need it any more |
| steve_j | jtiai does setting request.user save the session? surely not |
| jtiai | steve_j: Um... I don't think so. |
| steve_j | ]can't see why it woult |
| diofeher | hey, can i overwrite flatpage already registered, doing a extends at FlatPageAdmin and doing another registration like admin.site.register(FlatPage, FlatPageModifiedAdmin) |
| kezabelle | ya |
| kezabelle | do admin.site.unregister(FlatPage) IIRC |
| steve_j | diofeher yeah, that;s right |
| zimnyx | Docs says that Field.to_python() is used to convert database values to field values, why it is not run when I do: print MyModel.objects.get(pk=x).field_name ? I checked it with dbg. |
| zimnyx | Am I getting docs wrong? |
| zimnyx | It's written here http://docs.djangoproject.com/en/dev/howto/custom-model-fields/ "Converting database values to Python objects¶" |
| diofeher | steve_j: but didn't worked here... i was trying to add tinymce, and i did http://dpaste.com/140894/ |
| kezabelle | yes but you haven't unregistered flatpage |
| steve_j | yeah, you need to unregister it first |
| diofeher | ahhhh |
| steve_j | then re register |
| diofeher | kezabelle: like admin.site.unregister? |
| kezabelle | yes |
| kezabelle | see my previous line |
| munichlinux | 'InMemoryUploadedFile' object is unsubscriptable I this error I am trying to upload a file |
| Gratz474 | still not so sure to do about static content |
| Gratz474 | like all i need really isa user sign up and a few other things most of the pages will be static |
| munichlinux | self.cleaned_data['photo'].read() this is what I am doing |
| diofeher | haha, it worked... i didn't know about this method |
| diofeher | thanks kezabelle and steve_j |
| theju | munichlinux: that seems to be fine, a paste would be clearer |
| munichlinux | http://dpaste.com/140905/ |
| munichlinux | theju, ^ |
| theju | munichlinux: looks ok...which line are you getting the error from? |
| munichlinux | when i do the read |
|
|
| kezabelle | 1) shouldn't you be doing chunks() instead of read()? 2) have you checked teh data in cleaned_data is actually right? |
| theju | munichlinux: can you also paste the traceback? |
| zimnyx | I want my database value to be modified before setting it as model field value - how can I achieve this? |
| munichlinux | kezabelle, yes because once the form is valid it comes to the next step |
| munichlinux | kezabelle, I tried replacing read with chunks I still get the same error |
| kezabelle | which is? theju already asked for the traceback |
| kezabelle | also, shouldn't clean return all the cleaned data, not just the one field (I know thats not the issue in this case as you only have one field, but you're doing a field specific clean there) |
| munichlinux | traceback: http://dpaste.com/140925/ |
| munichlinux | kezabelle, so what do you suggest? |
| munichlinux | theju, ^ |
| theju | i think what kezabelle was suggesting is right...clean on a form should return the cleaned_data and not cleaned_data on a particular field |
| kezabelle | I'm gonna go out on a ;imb and say its teh cleaning data |
| kezabelle | christ that was bad typing |
| kezabelle | see, what theju said |
| kezabelle | I think you're accessing a dictionary key which exists, but is empty now you've cleaned it |
| kezabelle | wherever you're returning just the single dictionary item in clean, I /think/ it needs to be the whole dictionary. Or, you change the clean method to be field specific |
| theju | munichlinux: in simpler words, clean should return a dictionary but you are return a value, so the unsubscriptable error, just rename the clean method to clean_photo and things will work |
| munichlinux | theju, ok thanks let me try |
| wolfalfa | hi guys. when I delete a record, all the related records are deleted as well. this is by default. is there any way to avoid/override this behavior? |
| munichlinux | theju, kezabelle ya it worked thanks |
| theju | wolfalfa: nope |
| wolfalfa | :) |
| wolfalfa | not encouraging |
| theju | wolfalfa: actually you could go through the delete method on the model and override it in your model, but it is not recommended because it doesn't make sense to have related records exist when the parent record is deleted |
| kezabelle | I was about to say, you could override delete() and clear the related records |
| kezabelle | theju: sometimes, it does. You shouldn't have to keep orphans around, but sometimes, to make ommelettes, you make cheese out of a terrible db schema |
| theju | kezabelle: probably, but i would prefer to do it in the schema than in the code...anyways contexts can be different and i think the user has to decide the best path available to him |
| wolfalfa | kezabelle: now that you mention it, it makes sense to reassign the orphans to a different parent before deleting that |
| jtiai | And sometimes it's preferred not to delete parents if childs exists, just to make sure that db doesn't get poor orphans... |
| jtiai | There is even ticket for that #7539. |
| DjangoBot | http://code.djangoproject.com/ticket/7539 |
| FireSlash | Hi guys. Not sure if this is django related or something else, but I have a server that works fine, except randomly after a long time (~2 months or so) of uptime, it dies with [Errno 13] Permission denied: '/.python-eggs' |
| FireSlash | restarting the server fixes it and it's good for another ~2 months |
| FireSlash | any ideas? |
| kyrix | strange |
| wolfalfa | FireSlash: check if you have some update/upgrade code running somewhere? apt / yum / similar |
| FireSlash | They're not. We do our updates on specific days, the schedulers are all off |
| kyrix | FireSlash, whats the memory usage while its hanging? |
| FireSlash | 366 or so free, and over a gig of unused swap |
| kyrix | FireSlash, whats the platform/setup etc |
| Liberum | It seems that the solutions available for translation of individual fields in contents are either terribly incomplete, non-idiomatic or require you to specify the languages to translate to in advance. Do I need to fork or roll my own in order to get a translation system that supports definition of languages on the fly? |
| kyrix | Liberum, afaik, yes |
| Liberum | django-modeltranslation looks terribly good, by the way, apart from requiring definition of languages as a part of server configuration. |
| Liberum | kyrix: Thanks. |
| kyrix | Liberum, but probably not very hard to implement |
| FireSlash | RHEL 64 bit, not sure on the exact django version since we've upgraded it a few times to sort out some sql issues, but it's .9x |
| kyrix | FireSlash, wsgi apache... ? |
| FireSlash | apache, mod_python |
| Liberum | kyrix: My thoughts exactly, although I would have liked to be on a standard path. Maybe contact django-modeltranslation author and suggest a fork. |
| diofeher | hey ppl, what happened to djangopeople.com? |
| FireSlash | also python 2.3 |
| theju | diofeher: did you mean djangopeople.net? |
| kyrix | diofeher, no idea, dns down it seems |
| edgarallanpoe | how do i find all model instances where timestamp != None? |
| kyrix | FireSlash, do you got full access to server? |
| FireSlash | kyrix, Yeah. |
| jtiai | edgarallanpoe: you mean .filter(timestamp_isnull=False)? |
| kyrix | FireSlash, ok, first question, any reason to be using modpython instead of wsgi? |
| edgarallanpoe | jtiai that worked for me thanks |
| kyrix | Liberum, let me know if you do anything. id be interested in helping out |
| FireSlash | I didn't do the original setup on this server, but I don't think WSGI was "ready" when this server was originally setup. |
| edgarallanpoe | jtiai is there a more generic way to negate the comparison in the django orm? if i wanted to find all articles that were NOT written in the month of february, for example? |
| FireSlash | There hasn't been a compelling reason to switch away from mod_python, so we've been using it since. |
| edgarallanpoe | basically a way to say "!=" in the model query to any comparison? |
| jtiai | edgarallanpoe: Q queries. |
| kyrix | FireSlash, ok. To me it seems like a complicated problem, as the problem could be anywhere (from the app down to apache or filesystem) |
| kyrix | FireSlash, so I would try isolating the error slowly. |
| FireSlash | Hmm, just got odder too. The error changed to ImportError: cannot import name connection |
| edgarallanpoe | hmm, just googled "q queries" but didn't return much, can you either point me in the right direction to find out more about q queries or just show me an example? |
| kyrix | edgarallanpoe, look at the official docs |
| diofeher | theju: yep, djangopeople.net! :P |
| kyrix | and its Q queries, not q queries :) |
| FireSlash | kyrix, Ok. That was my plan, I was just hoping someone else might have seen it before :) |
| jtiai | edgarallanpoe: http://docs.djangoproject.com/en/1.1/topics/db/queries/#complex-lookups-with-q-objects |
| theju | diofeher: the domain name expired |
| edgarallanpoe | thanks jtiai |
| diofeher | theju: oh, i see... |
| kyrix | FireSlash, i would start with a filesystem monitor to see if permissions change |
| theju | diofeher: just tweeted to simonw about this...you should check his reply soon |
| kyrix | somehow |
| kyrix | edgarallanpoe, btw. when u google use the keyword django too. |
| kyrix | or +django is better |
| FireSlash | kyrix, I already checked the permissions on that folder while it was giving the permissions error, they were correct |
| edgarallanpoe | ok thanks kyrix |
| FireSlash | At which point I get to file a report to my boss about the gremlins in one django server. :3 |
| kyrix | FireSlash, then i would try setting up a virtualenv without dist for your django app |
| kyrix | and see how that goes |
| ironfroggy | I've seen so many conflicting usage patterns i can never be sure, are having apps in non-toplevels supported by django or simply accidentally working? |
| kezabelle | should be able to have them anywhere on the python path, IIRC |
| kyrix | ironfroggy, apps in non-top levels? as long as they are on the path.... they can be anywhere |
| FireSlash | kyrix, Already have one. Though it doesn't see much traffic since we only use it for dev purposes, it works fine. This doesn't whitelist the code though, due to the lack of traffic |
| FireSlash | I might just swap them out for a month and see what happens though |
| kyrix | FireSlash, can u try to stresstest it? |
| kyrix | or swap :D |
| ironfroggy | kyrix: things like, "company.internal_app" in INSTALLED_APPS are supposed to work? |
| FireSlash | I've tried a few scenarios, but the stresstest didn't prove anything other than we paid too much for that server :P |
| kyrix | ironfroggy, of course |
| kezabelle | ironfroggy: yes |
| diofeher | theju: ok! i'm following u there :P |
| ironfroggy | i just hit a snag with such an app being used as the AUTH_PROFILE_MODULE |
| ironfroggy | actually i might have not looked at this correctly.... |
| joe4444 | how can i avoid evaluating this query four times? i thought django evaluates it once on h.count() then uses cache for the rest, but this code takes 4 times longer than expected. http://dpaste.com/140933/ |
| kezabelle | you'll have made the mistake everyone does, ironfroggy ;) |
| kyrix | kezabelle, it took me a while to truly understand path, and it still makes me wonder sometimes ;) |
| kezabelle | that it points at the whole module |
| ironfroggy | ok this is the part where i get unsure this is supposed to be allowed |
| jtiai | joe4444: Because you do it all wrong :D |
| kezabelle | so for example, mine is |
| theju | joe4444: count only does a select count()...it does not evaluate |
| kezabelle | "profiles.Profile" (a model) |
| jtiai | joe4444: and every "index" fetch is actually slice generating _new_ queryset. |
| kezabelle | you don't actually put models in, I can't really remember why |
| theju | joe4444: if you want to evaluate it...use len() or list |
| ironfroggy | because the applabel is the module, not the qualified path. so you can technically have foo.bar and baz.bar as two apps, but now you can't refer to them correctly in places that take an applabel |
| Liberum | kyrix: I will. I'm gonna look around and maybe create an implementation draft. Message me your e-mail and I'll be in touch today or tomorrow. |
| kezabelle | ironfroggy: yes |
| kyrix | Liberum, now that django people is down... where do i put my contact info? :) |
| ironfroggy | see, i would think either applabel should include the whole path or you shouldn't be allowed to use multiple levels |
| ironfroggy | i dont even like having this setup, but I'm stuck with it for the most part. |
| ironfroggy | i have one that's even 4 levels deep |
| ironfroggy | app1.app2.app3.app4 |
| ironfroggy | cleanup is too time consuming to do all at once, but i'm making inroads to correcting as much as i can |
| kyrix | ironfroggy, too many levels very evil |
| jtiai | ironfroggy: there is some ticket about namespaces for apps too, because name conflicts and figuring out artifical names for apps is quite stupid... |
| kyrix | ironfroggy, its easier to bundle apps in projects, and never have the apps themselves on the path |
| kyrix | ironfroggy, only projects in path |
| joe4444 | i see, so really all i need to do is replace if h.count() > 0 with if len(h) > 0 and the rest will pull from cache? |
| kyrix | ironfroggy, hold on, i saw a presentation on it once |
| ironfroggy | i wish applabels were never created. we should have two ways of identifying a package. |
| jtiai | joe4444: You might want to read about Django queryset evaluation... |
| joe4444 | jtiai: yeah i read it but mistakenly thought .count() evaluates |
| kyrix | ironfroggy, but we do. we have projects and apps :) |
| jtiai | joe4444: Well description of count tells quite exactly what it does. |
| kyrix | whats the site that has all the presentations? |
| Artis_ | hey, I have an error... |
| Artis_ | AttributeError: 'Manager' object has no attribute 'raw' |
| Artis_ | why? |
| zimnyx | I want to store dictionary in a model field, any tips? (In fact I want it to be serialized before write to database, and deserialized when read from db). Any tips? |
| Stavros | hello |
| kezabelle | Artis_: on what code? (dpaste or pastie pls, not in here) |
| kyrix | ironfroggy, http://www.b-list.org/weblog/2006/sep/10/django-tips-laying-out-application/ |
| fission61 | anyone here play around with linkedin from an api standpoint or just use it regularly? if so i have a curious question |
| Stavros | this is an odd request for #django, but i would like to hire a good developer to work on a php codebase, and this is where the good developer are... is anyone interested? |
| kezabelle | zimnyx: tried looking at the serializers docs? |
| joe4444 | jtiai: well i read an example showing how the first time a qs is evaluated each successive "fetch" is from cache... and i assumed .count() was evaluating, but of course it makes much more sense that it does not b/c it's SELECT COUNT() rather than SELECT * |
| kyrix | ironfroggy, http://www.youtube.com/watch?v=A-S0tqpPga4 |
| kezabelle | zimnyx: or maybe even just pickle? |
| jtiai | zimnyx: django-command-extensions might had a pickledfield... |
| jtiai | zimnyx: Well, it had "JsonField" that actually serializes data to json.. |
| kyrix | Stavros, are you paying $300 the hour? then i might think of using php again ;) |
Popular searches: