GUID discussion

2006-01-08 Thread mitja
This is a roundup of a discussion that has been taken place in Ticket 1180 about guid generation. http://code.djangoproject.com/ticket/1180 I put it here because discussion should take place in the list. (sorry hugo for putting my suggestion in the ticket, it was my lazy sunday...) - The mechani

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
Hi Cheng, I had expected that flatten_data would "do the right thing" but as you demonstrate it seems that the manipulator doesn't flatten it correctly either. The CheckboxField expects booleans to be "on" for True and "" for False so i guess this is what the manipulator should flatten to, rathe

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread Cheng Zhang
ok, here is result under Python shell: >>> from django.models.auth import users >>> u=users.get_object(pk=1) >>> m=users.ChangeManipulator(1) >>> new_data=m.flatten_data() >>> from django.utils.datastructures import MultiValueDict >>> mvd = MultiValueDict() >>> mvd.update(new_data) >>> mvd 'last

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
OK typo there. Clearly time for sleep. Try this: === from django.utils.datastructures import MultiValueDict def profile_edit_info(request, user_id): try: manipulator = users.ChangeManipulator(user_id) except users.UserDoesNotExist: raise Http404 if request.POST: # flatten e

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
OK, so it looks like do_html2python requires a MultiValueDict. This is getting ugly, but try: from django.utils.datastructures import MultiValueDict def profile_edit_info(request, user_id): try: manipulator = users.ChangeManipulator(user_id) except users.UserDoesNotExist: rais

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread Cheng Zhang
I don't think this gonna work. I test the idea under Python shell: >>> from django.models.auth import users >>> u=users.get_object(pk=1) >>> m=users.ChangeManipulator(1) >>> new_data=m.flatten_data() >>> new_data {'username': 'czhang', 'first_name': 'Zhang', 'last_name': 'Cheng', 'last_login_t

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
How about this instead? The view code: == def profile_edit_info(request, user_id): try: manipulator = users.ChangeManipulator(user_id) except users.UserDoesNotExist: raise Http404 if request.POST: # flatten existing data to strings new_data = manipulator.flatten_dat

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
Rewind a bit. Actually, that recipe you were using was designed to prevent people from updating fields that they aren't supposed to by posting faked form fields. So don't do what I just suggested because people could change their status to superuser or whatever by posting fake form fields. So

Re: Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread kmh
Cheng Zhang wrote: >if request.POST: > new_data = request.POST.copy() > > # here I am filling in fields from the fetched object > # to make sure that the user can't pass in security relevant > # data. Make sure that you turn your values into strings, > # as that's exp

Re: How to handle i18n in patches?

2006-01-08 Thread Russell Keith-Magee
On 1/8/06, hugo <[EMAIL PROTECTED]> wrote: So I would say: add translation strings to magic removal, but don't runmake-messages.py. Instead just run that after merging magic-removalback to trunk and so only have _one_ set of .po files. Ok. I'll leave the po files alone.Thanks,Russ Magee %-)

Bug with django.core.formfields.CheckboxField.html2python()?

2006-01-08 Thread Cheng Zhang
In our app, we have this user edit their own profile page, where the user's model is just the default auth.users. In this page, we only allow the user to change their email, first name and last name, nothing else. So I use this trick from Django wiki cookbook (http://code.djangoproject.com/

Re: Proposal: Django namespace simplification

2006-01-08 Thread kmh
hugo wrote: > >I like this idea, but I think that shortcuts of whatever should use > >explicit imports such as > [...] > >This makes it a lot easier to tell what exactly you'll get if you > >import django.shortcuts. > > Yes, most definitely. The "simplified API importer" should only do > explicit

Re: Proposal: Django namespace simplification

2006-01-08 Thread kmh
Hi Adrian, Your opinion of the my suggestions fits pretty closely with mine. Adrian Holovaty wrote: > On 1/7/06, kmh <[EMAIL PROTECTED]> wrote: > > django.utils.httpwrappers -> django.http > > +1. I'm a big fan of this. django.http would get that'd get the > current contents of django.utils.htt

Re: subdomain specific settings file - new idea

2006-01-08 Thread Daniel Poelzleithner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ivan Fedorov wrote: >>URL_RESOLVER = "django.core.urlresolvers.RegexURLResolver" > > +1 > >>You could do very nice things with this approach, like using a database >>to resolve the url, or even change the other settings depending on the >>hostname y

Re: Proposal: Django namespace simplification

2006-01-08 Thread hugo
>I like this idea, but I think that shortcuts of whatever should use >explicit imports such as [...] >This makes it a lot easier to tell what exactly you'll get if you >import django.shortcuts. Yes, most definitely. The "simplified API importer" should only do explicit imports of the stuff that s

Re: Proposal: Django namespace simplification

2006-01-08 Thread Joseph Kocherhans
On 1/8/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > > django.core.extensions -> django.shortcuts > > - includes render_to_string > > +1. "django.shortcuts" is a *perfect* name for this module. I like this idea, but I think that shortcuts of whatever shoul

Re: Proposal: django.models.core/auth should be regular apps

2006-01-08 Thread Joseph Kocherhans
Here's a status update on moving dango.contib.core/auth into django.contirb: * Move sessions from core to django.contrib.sessions (and change dependencies) Done. * Move sites from core to django.contrib.sites (and change dependencies) Done. * Move auth to django.contrib.admin (and change depend

Re: Proposal: Django namespace simplification

2006-01-08 Thread Amit Upadhyay
On 1/8/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: On 1/7/06, kmh <[EMAIL PROTECTED]> wrote:> django.core.exceptions -> django.error+1We have a lot of django.http , django.shortcuts, django.form, django.contrib: single depth names, so we should allow this too,  though I prefer django.excepti

Re: Proposal: Django namespace simplification

2006-01-08 Thread Adrian Holovaty
On 1/7/06, kmh <[EMAIL PROTECTED]> wrote: > django.utils.httpwrappers -> django.http +1. I'm a big fan of this. django.http would get that'd get the current contents of django.utils.httpwrappers, plus the Http404 and Http500 exceptions. > django.core.template -> django.template >

Re: How to handle i18n in patches?

2006-01-08 Thread hugo
>I have run 'bin/make-messages.py -l en' to produce changes to the >English .po file. However, it concerns me that I needed to set >DJANGO_SETTINGS_MODULE - this implies that the script is adding i18n >strings from my currently installed application, not just from my >changes to Django source. Mak

How to handle i18n in patches?

2006-01-08 Thread Russell Keith-Magee
Hi all, What procedure should be followed if a patch to Django requires a new i18n string? I have run 'bin/make-messages.py -l en' to produce changes to the English .po file. However, it concerns me that I needed to set DJANGO_SETTINGS_MODULE - this implies that the script is adding i18n strings

Re: mysql microsecond replace error

2006-01-08 Thread Graham King
Yes, it was that. Thank you very much for the help. Dody Suria Wijaya wrote: Your field might be a type of DateTimeField, and you passed a Date object. graham_king wrote: Dear django developers, Using the latest django from SVN with python 2.4.2 and mysql 4.1.14, when I try and save an

Re: mysql microsecond replace error

2006-01-08 Thread Dody Suria Wijaya
Your field might be a type of DateTimeField, and you passed a Date object. graham_king wrote: Dear django developers, Using the latest django from SVN with python 2.4.2 and mysql 4.1.14, when I try and save an object with a date in it I get the following error: File "test.py", line 9, in

mysql microsecond replace error

2006-01-08 Thread graham_king
Dear django developers, Using the latest django from SVN with python 2.4.2 and mysql 4.1.14, when I try and save an object with a date in it I get the following error: File "test.py", line 9, in ? -- my code activity.save() -- my code File "/usr/lib64/python2.4/sit