Re: How decoupled should forms and models be (was: Re: Move form_for_instance and form_for_model into django.db.models.Model?)

2007-07-12 Thread Malcolm Tredinnick
On Fri, 2007-07-13 at 01:31 -0400, Todd O'Bryan wrote: > On Fri, 2007-07-13 at 14:43 +1000, Malcolm Tredinnick wrote: > > > I'm -1 one on this for pretty much the same reasons as Adrian. It's just > > not that big a deal even for people who want to work the way you do. > > I should have re-subje

Re: How decoupled should forms and models be (was: Re: Move form_for_instance and form_for_model into django.db.models.Model?)

2007-07-12 Thread James Bennett
On 7/13/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > My question for the rest of the second message was a question of how > much separation between forms and models there should be. For me the > validation issue is key. We currently don't have any standard way to > programmatically validate model

With AGLOCO You can earn money so good.

2007-07-12 Thread support team
Hi. We would like to notify to you new affiliate program that name is AGLOCO. Please Read it be carefully With AGLOCO You can earn money, and valuable shares too, when you surf the web like you always do. What is AGLOCO(tm) all about? AGLOCO is the first Internet based economic network, which

How decoupled should forms and models be (was: Re: Move form_for_instance and form_for_model into django.db.models.Model?)

2007-07-12 Thread Todd O'Bryan
On Fri, 2007-07-13 at 14:43 +1000, Malcolm Tredinnick wrote: > I'm -1 one on this for pretty much the same reasons as Adrian. It's just > not that big a deal even for people who want to work the way you do. I should have re-subjected my second post, since I'm willing to accept the loss of a poss

Re: Ticket 3505, Authentication backend

2007-07-12 Thread Russell Keith-Magee
On 7/12/07, Mario Gonzalez <[EMAIL PROTECTED]> wrote: > > in my settings file I set AUTHENTICATION_BACKENDS = ('something.that- > doesnot.exists') so when you use the authenticate() method in some > view a ValueError is raised. So, my patch catch that exception in > load_backend() method. > > I

Re: Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 18:21 -0400, Todd O'Bryan wrote: > form_for_instance and form_for_model are great, but if you have to tweak > the form in any way (say you want to use a non-default widget for one of > the data fields) and want to use it more than once, you're reduced to > defining a new For

Re: Unicode Keys

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 20:08 -0500, Jeremy Dunck wrote: > On 7/12/07, Collin Grady <[EMAIL PROTECTED]> wrote: > > For instance, if I have an input with name="語" and request.POST > > doesn't support unicode, how do I then get the value for that? :) > > I believe the issue is that *names* for kwargs

Re: Problem using RadioSelect with newforms-admin

2007-07-12 Thread Russell Keith-Magee
On 7/10/07, leif strickland <[EMAIL PROTECTED]> wrote: > > As you can see, the template is expecting a unicode object, but the > RadioSelect widget returns a RadioFieldRenderer object. > > I was able to get around this problem by subclassing RadioSelect and > adding to its render method: I'm not

Re: db2 backend

2007-07-12 Thread Justin Bronn
I have no experience with DB2, but I'm interested in a backend for Django. Specifically, my interest stems from DB2's spatial database offering ("Spatial Extender") that is free and feature complete (OGC compliant). Oracle and ArcSDE have high licensing fees, and MySQL's spatial support is extrem

Re: python.py deserialization and handling foreign key fields ?

2007-07-12 Thread Russell Keith-Magee
On 7/13/07, Etienne Robillard <[EMAIL PROTECTED]> wrote: > Any pointers how to work-around this issue ? On a side note - this message should have been sent to Django-users, not django-developers. Django-developers is for discussing the development of Django itself, not for general user queries.

Re: python.py deserialization and handling foreign key fields ?

2007-07-12 Thread Russell Keith-Magee
On 7/13/07, Etienne Robillard <[EMAIL PROTECTED]> wrote: > > How should exceptions caught by FieldDoesNotExist be handled > when trying to deserialize a object mapping to native python data types? ... > Any pointers how to work-around this issue ? I'm unclear what the issue is. Are you building

Re: Adding support for ~ to Q objects (negation)

2007-07-12 Thread Russell Keith-Magee
On 7/13/07, Nick <[EMAIL PROTECTED]> wrote: > > On Jul 13, 8:36 am, Collin Grady <[EMAIL PROTECTED]> wrote: > > As such, the following patch was born, allowing ~q instead of > > QNot(q) :) > > > > http://code.djangoproject.com/ticket/4858 > > I've had to use the QNot() myself too, and agree that

Re: Unicode Keys

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Collin Grady <[EMAIL PROTECTED]> wrote: > For instance, if I have an input with name="語" and request.POST > doesn't support unicode, how do I then get the value for that? :) I believe the issue is that *names* for kwargs can not be unicode. In [1]: u='語'.decode('utf-8') In [2]: {u:1

Re: Translated fields

2007-07-12 Thread [EMAIL PROTECTED]
On Jul 12, 7:47 pm, Collin Grady <[EMAIL PROTECTED]> wrote: > Have you seenhttp://code.google.com/p/i18ndynamic/? :) See I thought it would be easy! ;-) Thanks for the link, this is it exactly! -Doug --~--~-~--~~~---~--~~ You received this message because

Re: Adding support for ~ to Q objects (negation)

2007-07-12 Thread Nick
On Jul 13, 8:36 am, Collin Grady <[EMAIL PROTECTED]> wrote: > Simon requested I bring this up here - I was working through a problem > with a user on IRC, and he noted that Q objects support the bitwise & > and |, but not ~ - if you wanted to negate a Q object, you had to > explicitly import QNo

Re: Translated fields

2007-07-12 Thread Collin Grady
Have you seen http://code.google.com/p/i18ndynamic/ ? :) On Jul 11, 3:16 pm, Marc Garcia <[EMAIL PROTECTED]> wrote: > Hi all! > > I've been searching for a way to create a multilingual catalog with > django, and there is just one thing missing, a simple way for > translating information on databa

Re: Unicode Keys

2007-07-12 Thread Collin Grady
Passing raw GET params into a function seems like a recipe for disaster if you fail to validate something properly. Plus, unicode is allowed to be used as get/post keys, so not supporting it in the dict keys would cause problems. For instance, if I have an input with name="語" and request.POST do

Re: Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Collin Grady
This doesn't seem a far step from the model fields being able to return appropriate form fields, which they already do, so there's some tie-in already :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django devel

Adding support for ~ to Q objects (negation)

2007-07-12 Thread Collin Grady
Simon requested I bring this up here - I was working through a problem with a user on IRC, and he noted that Q objects support the bitwise & and |, but not ~ - if you wanted to negate a Q object, you had to explicitly import QNot and use that instead. As such, the following patch was born, allo

Re: Unicode + memcache = bug

2007-07-12 Thread Simon G.
#4845 is probably related here in some way, giving this traceback: PythonHandler django.core.handlers.modpython: MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert your unicode strings using mystring.encode(charset)! There's a few patches there which force the keys to ASCII

Re: Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Todd O'Bryan
On Thu, 2007-07-12 at 15:40 -0500, Adrian Holovaty wrote: > On 7/12/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > Is there a good reason not to do something like the following in > > django.db.models.Model? > > > > def form(self): > > return form_for_instance(self) > > > > @classmethod > > d

Re: Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Adrian Holovaty
On 7/12/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > Is there a good reason not to do something like the following in > django.db.models.Model? > > def form(self): > return form_for_instance(self) > > @classmethod > def form(cls): > return form_for_model(cls) Yes -- the good reasons agai

Re: Unicode + memcache = bug

2007-07-12 Thread Bryan
probably my headache is limiting my ability to rationally articulate. :) On Jul 12, 11:24 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 7/12/07, Bryan <[EMAIL PROTECTED]> wrote: > > > trying to do a .set with bytestrings that contain non ascii char > > values doesn't work. It has to do a .

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Bryan <[EMAIL PROTECTED]> wrote: > trying to do a .set with bytestrings that contain non ascii char > values doesn't work. It has to do a .encode('UTF-8') on the string I > was attempting to push into memcached. and likewise on pulling it > back out I had to do a .decode('UTF-8').

python.py deserialization and handling foreign key fields ?

2007-07-12 Thread Etienne Robillard
Hi all, How should exceptions caught by FieldDoesNotExist be handled when trying to deserialize a object mapping to native python data types? For example, I have a csv row which I would like to deserialize into a model instance, but it breaks when trying to convert any foreign key field, giv

Re: Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Marty Alchin
On 7/12/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > As I was writing this, I realized that you can't do this in Python > because you can't overload function names, but surely somebody smarter > than me can figure out a clever way that model_instance.form() and > ModelClass.form() would both do t

Re: Unicode + memcache = bug

2007-07-12 Thread Bryan
I ran into a similar issue when accessing the memcached python api. When running django unicode the value returned from the database was valid. However when running the non unicode version of django it'd blow up in my face. trying to do a .set with bytestrings that contain non ascii char value

Move form_for_instance and form_for_model into django.db.models.Model?

2007-07-12 Thread Todd O'Bryan
Is there a good reason not to do something like the following in django.db.models.Model? def form(self): return form_for_instance(self) @classmethod def form(cls): return form_for_model(cls) As I was writing this, I realized that you can't do this in Python because you can't overload fu

Re: Proposal: customtags, a higher-level API for template tags

2007-07-12 Thread Tom Tobin
On 7/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Thu, 2007-07-12 at 01:58 -0500, Tom Tobin wrote: > > Over at the Lawrence Journal-World, we have a bunch of custom template > > tags included in Ellington, our commercial CMS based on Django. One > > day, I finally got fed up with wr

Re: Unicode Keys

2007-07-12 Thread David Cramer
Ya it's probably not a great practice. I argued about these should be str's for an hour yesterday and I was convinced to drop it :) Gábor Farkas wrote: > David Cramer wrote: > > Is there any reason why its storing the keys in QueryDict (possibly > > others) as unicode? > > > > i think it's for con

Re: Proposal: customtags, a higher-level API for template tags

2007-07-12 Thread Tom Tobin
On 7/12/07, Baptiste <[EMAIL PROTECTED]> wrote: > > I have tried to read this patch, but its presentation is really > awful.. But even if I have stopped to read, that seems to be a very > big work! I would like to see it from Trac or I don't know what but > from something that makes him legible ;-

Re: Ticket 3505, Authentication backend

2007-07-12 Thread Mario Gonzalez
On 11 jul, 22:33, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > > > if AUTHENTICATION_BACKENDS is empty or something is wrong then > > nothing is detected, only an ImporError. The patch catch the > > ValueError. > > Where and how is the error revealed? When you import an application? > When

Re: db parameter impemtation

2007-07-12 Thread Carl Karsten
> By the way, there's one case where we can't always use parameters: IN > value lists. Converting Python tuples to a correctly formatted list > appropriate for IN-clauses isn't a standard part of the DB-API, so we do > that via manual substitution. know off hand where that is? I might be able t

Re: db parameter impemtation

2007-07-12 Thread Carl Karsten
Russell Keith-Magee wrote: > On 7/12/07, Carl Karsten <[EMAIL PROTECTED]> wrote: >> Jacob Kaplan-Moss wrote: >>> OK, we're 8 messages deep into this thread, and I've got no idea what >>> the point is. >>> >>> Carl -- what is it you want to know? Is something not working >>> correctly for you, or i

Re: Unicode + memcache = bug

2007-07-12 Thread Chad Maine
I did notice this bug, but it went away when I switched to cmemcache (a much faster alternative if its availble to you). On 7/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > > When using the low-level cache and memcache as the backend, you're > likely to run into this stack trace: > > ... > Fil

Re: db parameter impemtation

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 22:27 +1000, Malcolm Tredinnick wrote: > On Wed, 2007-07-11 at 16:10 -0500, Carl Karsten wrote: > [...] > > It is pretty much this simple: > > > > import settings > > import MySQLdb > > > > con = MySQLdb.connect(user=settings.DATABASE_USER, > > passwd=settings.DATABASE

Re: Unicode + memcache = bug

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 08:55 -0500, Jeremy Dunck wrote: > On 7/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: > ... > > > What's going on here is that the memcache.py library does this with > > > the passed parameters: > > > > > >

Re: Decouple simplejson from Django?

2007-07-12 Thread Marty Alchin
On 7/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > If you consider the testing framework core, then serialization is, > because the testing framework uses it for fixtures. See? I knew I was missing something obvious. -Gul --~--~-~--~~~---~--~~ You received thi

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: ... > > What's going on here is that the memcache.py library does this with > > the passed parameters: > > > > fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val), v

Re: Proposal: customtags, a higher-level API for template tags

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 23:24 +1000, Malcolm Tredinnick wrote: [...] > > A few comments (mostly questions) from an initial reading: One I forgot... (10) On my radar to commit fairly soon is one of Brian Harring's speed-ups for variable resolution -- #3453. It looks like this won't have any real e

Re: Unicode + memcache = bug

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: > When using the low-level cache and memcache as the backend, you're > likely to run into this stack trace: > > ... > File "/pegasus/code/current/django/core/cache/backends/memcached.py" in set > 48. self._cache.set(key, value, timeout or s

GSoC Update: [Check Constraints] Unicode Compatible, Doctests and a lot more...

2007-07-12 Thread Thejaswi Puthraya
Hello Django Developers, This week saw a lot of change in the Check Constraints project. First, most of the SQL generation code has moved from the management.py to the Check class. Initially I was very reluctant to move the code from management.py to the Check Class (because I had the feeling that

Re: Proposal: customtags, a higher-level API for template tags

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 01:58 -0500, Tom Tobin wrote: > Over at the Lawrence Journal-World, we have a bunch of custom template > tags included in Ellington, our commercial CMS based on Django. One > day, I finally got fed up with writing the same damned boilerplate > code for custom tags over and o

Re: Decouple simplejson from Django?

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > I > just wanted to point out that it seemed strange to me to consider it a > core requrement for the serializer, and in fact of Django itself. If you consider the testing framework core, then serialization is, because the testing framework use

Re: Decouple simplejson from Django?

2007-07-12 Thread Marty Alchin
Oh, I should also clarify something. I don't actually think simplejson should be removed from Django itself. It's only a few files, and is certainly worth saving people extra trouble for such a common case. I just wanted to point out that it seemed strange to me to consider it a core requrement fo

Re: db parameter impemtation

2007-07-12 Thread pk11
Hi all, Not to hijack the thread but I think Django indeed supports prepared statements if the underlying db-binding supports it. This is from cx_Oracle's doc (http://www.cxtools.net/default.aspx? nav=cxorlb): execute(statement, [parameters], **keywordParameters) Execute a statement

Re: Decouple simplejson from Django?

2007-07-12 Thread Marty Alchin
On 7/12/07, James Bennett <[EMAIL PROTECTED]> wrote: > The other modules you mention are optional to a certain extent (don't > technically need flup to do Django-as-WSGI, can use Django without a > database or with your choice of DB adapter), but simplejson is > absolutely required for the seriali

Re: db parameter impemtation

2007-07-12 Thread Malcolm Tredinnick
On Wed, 2007-07-11 at 16:10 -0500, Carl Karsten wrote: [...] > It is pretty much this simple: > > import settings > import MySQLdb > > con = MySQLdb.connect(user=settings.DATABASE_USER, > passwd=settings.DATABASE_PASSWORD, > db=settings.DATABASE_NAME ) > cur=con.cursor() > > cur.execu

Re: Decouple simplejson from Django?

2007-07-12 Thread Johan Bergström
> Can you use the ORM without a database adapter? Ok, that might sound a bit stupid since you already kind of answered that in the post above. What i meant was that Django has lot of different imports, and without some of them (say a database adapter) Django is crippled. I personally don't see a

Re: (Un)Trac

2007-07-12 Thread Kevin Menard
On 7/12/07, Peter Nixon <[EMAIL PROTECTED]> wrote: > > On Thu 12 Jul 2007, Jeremy Dunck wrote: > > On 7/12/07, Peter Nixon <[EMAIL PROTECTED]> wrote: > > > Am I just being dense, or is there no way in django's trac to monitor a > > > bug for changes (and receive and email when it does) or even to

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: ... > It may be that only the memcache backend has this problem, but the > general solution I'd suggest is to use smart_str on the key given to > each low-level cache's backend set method. Works-for-me. To be clear, if this is accepted as a so

Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
When using the low-level cache and memcache as the backend, you're likely to run into this stack trace: ... File "/pegasus/code/current/django/core/cache/backends/memcached.py" in set 48. self._cache.set(key, value, timeout or self.default_timeout) File "/usr/lib/python2.5/site-packages/memcach

Re: (Un)Trac

2007-07-12 Thread Peter Nixon
On Thu 12 Jul 2007, Jeremy Dunck wrote: > On 7/12/07, Peter Nixon <[EMAIL PROTECTED]> wrote: > > Am I just being dense, or is there no way in django's trac to monitor a > > bug for changes (and receive and email when it does) or even to add a > > bug to a "my bugs" list?! > > In the "change proper

Re: (Un)Trac

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Peter Nixon <[EMAIL PROTECTED]> wrote: > Am I just being dense, or is there no way in django's trac to monitor a bug > for changes (and receive and email when it does) or even to add a bug to > a "my bugs" list?! In the "change properties" section, you want "CC". --~--~-~--~-

Re: (Un)Trac

2007-07-12 Thread Phil Powell
You can subscribe to individual issues using RSS. That's the way I tend to keep track of issues which are of particular interest to me. -Phil On 12/07/07, Peter Nixon < [EMAIL PROTECTED]> wrote: > > > Hi Guys > > Am I just being dense, or is there no way in django's trac to monitor a > bug > for

(Un)Trac

2007-07-12 Thread Peter Nixon
Hi Guys Am I just being dense, or is there no way in django's trac to monitor a bug for changes (and receive and email when it does) or even to add a bug to a "my bugs" list?! A bug tracker without these features is pretty crippled imho, especially when some of the bugs I am interested in hav

Re: Problem inspecting a (django) postgresql table

2007-07-12 Thread Peter Nixon
On Thu 12 Jul 2007, Gary Wilson wrote: > Ben Ford wrote: > > Peter, > > I ran into this problem when I was bringing the multi-db branch up to > > date and was so busy I forgot to tell anyone! (My bad) I fixed it, but > > it was on another machine. It's a pretty simple change, but the exact > > dif

Re: Proposal: customtags, a higher-level API for template tags

2007-07-12 Thread Baptiste
I have tried to read this patch, but its presentation is really awful.. But even if I have stopped to read, that seems to be a very big work! I would like to see it from Trac or I don't know what but from something that makes him legible ;-) Anyway, congratulations Baptiste On 12 juil, 08:58, "

Re: db parameter impemtation

2007-07-12 Thread Peter Nixon
On Thu 12 Jul 2007, [EMAIL PROTECTED] wrote: > Wow, I think I just figured out what this is about. He's asking if > Django creates queries like > 1) "SELECT id, song FROM songs WHERE id = 1" > or > 2) "SELECT id, song FROM songs WHERE id = ?", and the passing in the 1 > as a parameter. > > He say

Re: Decouple simplejson from Django?

2007-07-12 Thread Johan Bergström
On Jul 12, 8:55 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > The other modules you mention are optional to a certain extent (don't > technically need flup to do Django-as-WSGI, can use Django without a > database or with your choice of DB adapter), but simplejson is > absolutely required for