Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread limodou
On 8/16/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > In implementing the "manage.py testserver" command, I've been struck > > by how large django/core/management.py has gotten. It's 1730 lines > > long -- and messy. > > > > I'd like

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread limodou
On 8/16/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 8/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > Sounds like a really good idea to me -- looking forward to it! > > Cool -- I'm on it. > > > I'd like to suggest a (somewhat controversial) extension: > > > > Let any (installed)

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Adrian Holovaty
On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > In implementing the "manage.py testserver" command, I've been struck > by how large django/core/management.py has gotten. It's 1730 lines > long -- and messy. > > I'd like to split this into several files, turning > django.core.management in

Re: Oracle guys ... can you help with this?

2007-08-15 Thread Malcolm Tredinnick
On Thu, 2007-08-16 at 13:49 +1000, Malcolm Tredinnick wrote: > I'm not sure if any of the Oracle devs are watching django-users (no > need you should be, btw). In case you aren't you might be able to help > out on this thread > > http://groups.google.com/group/django-users/browse_frm/thread/fbaea

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Gary Wilson
Marty Alchin wrote: > On 8/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: >> This would let projects like S-E -- there's a reason I used it for the >> example -- provide custom management actions; installing said app >> would make those actions "appear" in manage.py. This would go a long >> w

Re: Only update modified fields

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 21:51 -0700, Collin Grady wrote: > Malcolm Tredinnick said the following: > > The current latest patch fails in a dangerous way, which is why I'm > > against it. Fail safely (so that my data always gets saved when I call > > save()) and it's up for consideration. > > Is the

Re: Only update modified fields

2007-08-15 Thread Collin Grady
Malcolm Tredinnick said the following: > The current latest patch fails in a dangerous way, which is why I'm > against it. Fail safely (so that my data always gets saved when I call > save()) and it's up for consideration. Is the failure you mention just the __setattr__ issue, or is there another

Re: Only update modified fields

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 21:09 -0700, Collin Grady wrote: > Malcolm Tredinnick said the following: > > See earlier threads for why transparent behaviour is not a very safe > > idea. If you override save(), for example, it's going to be very easy to > > end up with things not being saved. This is not

Re: Only update modified fields

2007-08-15 Thread Collin Grady
Malcolm Tredinnick said the following: > See earlier threads for why transparent behaviour is not a very safe > idea. If you override save(), for example, it's going to be very easy to > end up with things not being saved. This is not common behaviour, so > asking somebody to at least pass in an e

Oracle guys ... can you help with this?

2007-08-15 Thread Malcolm Tredinnick
I'm not sure if any of the Oracle devs are watching django-users (no need you should be, btw). In case you aren't you might be able to help out on this thread http://groups.google.com/group/django-users/browse_frm/thread/fbaeab8eef802e94 It's a little beyond my skillset with Oracle, but it looks

Re: ticket 3310

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 22:27 -0600, Norman Harman wrote: > Malcolm Tredinnick wrote: > > One obvious test would have been to create a test directory that didn't > > contain a models file but did contain a tests.py file. > I would be wary of writing unittests that created stuff on people's > filesy

Re: ticket 3310

2007-08-15 Thread Norman Harman
Malcolm Tredinnick wrote: > One obvious test would have been to create a test directory that didn't > contain a models file but did contain a tests.py file. I would be wary of writing unittests that created stuff on people's filesystem. > I think one reason the patch hasn't been applied is that i

Re: ticket 3310

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 21:04 -0600, Norman Harman wrote: > ticket 3310 http://code.djangoproject.com/ticket/3310 > manage.py test does not work if there is not a model.py in the application > > The 6mo patch doesn't apply anymore. Is there a reason it was never applied? > Apps > without models

Re: Only update modified fields

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 18:59 -0600, Norman Harman wrote: > SmileyChris wrote: > > Collin has put a lot of effort in to this ticket [1] which is still > > waiting as a design decision. The latest patch is (apart from lack of > > docs) ready for check-in in my opinion. Could we have a decision on > >

Re: ticket 3310

2007-08-15 Thread Russell Keith-Magee
On 8/16/07, Norman Harman <[EMAIL PROTECTED]> wrote: > > I'd like this to be fixed. I'd like to update the patch incorporating any > concerns the > list might have. I wouldn't like there to be someone else posting a similar > email as this > one in 6mo wondering why my patch was never applied.

suggestion about {% url %}

2007-08-15 Thread !张沈鹏(电子科大 08年毕业)
I think the url tag if can work like below maybe more useful . Example mytags.py: . @register.inclusion_tag('xxx.html') def page_link(url_name): return {"url_name":url_name} __ xxx.html: 1

ticket 3310

2007-08-15 Thread Norman Harman
ticket 3310 http://code.djangoproject.com/ticket/3310 manage.py test does not work if there is not a model.py in the application The 6mo patch doesn't apply anymore. Is there a reason it was never applied? Apps without models seem valid to me. I have a couple django apps that don't use db a

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Jannis Leidel
On 15 Aug., 19:51, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > I'd like to split this into several files, turning > django.core.management into a package. The purest way of splitting the > functionality would be to give each manage.py action ("runserver", > "syncdb", etc.) its own Python module

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Marty Alchin
On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > I think it would merely delay the bikeshed discussions. If we don't > have a required file layout, people will spend long mailing-list > threads five months from now talking about how *they* do things, and > how there should be an establishe

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Russell Keith-Magee
On 8/16/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > I'd like to split this into several files, turning > > django.core.management into a package. The purest way of splitting the > > functionality would be to give each manage.py ac

Re: Only update modified fields

2007-08-15 Thread Collin Grady
Norman Harman said the following: > Nobody knows me, so my opinion isn't worth much. But, this would be good. > Better would > be if it were transparent(properties or some other mechanism to notice when > fields are set > and therefore dirty/need updating). I'm fairly surprised something li

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Adrian Holovaty
On 8/15/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > That's just my opinion, but it seems like it could avoid a lot of > bikeshed discussions where people debate the best file structure to > use. I think it would merely delay the bikeshed discussions. If we don't have a required file layout, peo

Re: Only update modified fields

2007-08-15 Thread Norman Harman
SmileyChris wrote: > Collin has put a lot of effort in to this ticket [1] which is still > waiting as a design decision. The latest patch is (apart from lack of > docs) ready for check-in in my opinion. Could we have a decision on > whether this is worthy? Nobody knows me, so my opinion isn't wor

Re: manage.py idea?

2007-08-15 Thread Russell Keith-Magee
On 8/16/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > Would it be worthwhile to add a way to purge unused content types via > manage.py? It could look at INSTALLED_APPS and anything not installed > it removes? +1 to the idea - as noted elsewhere in the thread, this would be handled best as an im

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Marty Alchin
On 8/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > I'd like to suggest a (somewhat controversial) extension: > > Let any (installed) app provide its own manage.py actions in a similar > way -- something like:: > > schema_evolution/ > management/ > __init__.py >

Re: Newforms suggestions - pre_clean? magic cleaned_data? - access to errors?

2007-08-15 Thread Collin Grady
SmileyChris said the following: > The solution is that clean_* methods should just be passed the field's > value as an argument. > Even being backwards incompatible, I think it needs to be done. +1, passing them the value makes much more sense, IMO. -- Collin Grady I wouldn't marry her with a

Re: Newforms suggestions - pre_clean? magic cleaned_data? - access to errors?

2007-08-15 Thread SmileyChris
On Aug 15, 3:34 pm, sime <[EMAIL PROTECTED]> wrote: > >clean_field1 = generic_clean > >clean_field2 = generic_clean > > The problem here is generic_clean doesn't know which field it is, and > I can't pass arguments that way? Don't think we have field.name or > similar eithe

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Brantley Harris
On 8/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > Let any (installed) app provide its own manage.py actions in a similar > way -- something like: +1. As I was reading Adrian's post, I was thinking the very same thing. --~--~-~--~~~---~--~~ You received t

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread SmileyChris
On Aug 16, 5:51 am, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > This would be the extent of my refactoring for now. Any strong > thoughts either way before I go ahead and implement it? Sounds great! One other thing that would be nice is if the sql generation methods were refactored too so they

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Jacob Kaplan-Moss
On 8/15/07, George Vilches <[EMAIL PROTECTED]> wrote: > There aren't enough +1s in the world for me to vote as strongly as I > would like on both Adrian's initial proposal and this extension. That's just because I've been hoarding them. Once the bottom drops out of the subprime market I think the

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread George Vilches
> I'd like to suggest a (somewhat controversial) extension: > > Let any (installed) app provide its own manage.py actions in a similar > way -- something like:: > > schema_evolution/ > management/ > __init__.py > commands/ > __init__.py >

Re: Newforms suggestions - pre_clean? magic cleaned_data? - access to errors?

2007-08-15 Thread Nathaniel Whiteinge
> If your verification logic wants to know what field is verifying now, > you can use closure. > It is simple, Pythonic and doesn't change core :-) Closures; fantastic. The more I learn about Python the shorter and shorter my code gets. :-) Thanks very much for posting this, Vsevolod. I was abl

Re: manage.py idea?

2007-08-15 Thread Ville Säävuori
> Is this a common problem for people or just me? I don't run into it > with every app, but I do refactor my models often times and run into > this, and think it would be nice if there were a more automated way to > clean up those tables. I've bumped into this same problem several times. It woul

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Adrian Holovaty
On 8/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > Sounds like a really good idea to me -- looking forward to it! Cool -- I'm on it. > I'd like to suggest a (somewhat controversial) extension: > > Let any (installed) app provide its own manage.py actions in a similar > way -- something l

Re: manage.py idea?

2007-08-15 Thread Rob Hudson
On 8/15/07, Deryck Hodge <[EMAIL PROTECTED]> wrote: > Why not, rather than adding another option in django.core.management, > have the contenttypes app do this? The existing post_syncdb hook > could be extended to clear unused content types as well as create new > ones. > > You would have to reme

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Jacob Kaplan-Moss
On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > I'd like to split this into several files, turning > django.core.management into a package. The purest way of splitting the > functionality would be to give each manage.py action ("runserver", > "syncdb", etc.) its own Python module, like th

Re: manage.py idea?

2007-08-15 Thread Rob Hudson
On 8/15/07, Collin Grady <[EMAIL PROTECTED]> wrote: > Shouldn't really be an issue with his scenario though, since he said > this was during initial dev on the data model, so he wouldn't even have > much (if any) data yet :) Right, but when it comes time for the next app I create in that project,

Re: manage.py idea?

2007-08-15 Thread Deryck Hodge
On 8/15/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > On 8/15/07, Collin Grady <[EMAIL PROTECTED]> wrote: > > Wouldn't reset do that? > > > > ./manage.py reset auth contenttypes > > I haven't tried that but that looks like it would clear those tables > completely vs. purging only the unused tables

Re: manage.py idea?

2007-08-15 Thread Collin Grady
David Danier said the following: > Even if it did the id's might have changed and any generic relations be > broken. Shouldn't really be an issue with his scenario though, since he said this was during initial dev on the data model, so he wouldn't even have much (if any) data yet :) -- Collin G

Re: manage.py idea?

2007-08-15 Thread David Danier
> Would following that with a syncdb then restore the content types for > the installed apps? I'll have to test that later. Even if it did the id's might have changed and any generic relations be broken. Greetings, David Danier --~--~-~--~~~---~--~~ You received

Re: manage.py idea?

2007-08-15 Thread Rob Hudson
On 8/15/07, Collin Grady <[EMAIL PROTECTED]> wrote: > Wouldn't reset do that? > > ./manage.py reset auth contenttypes I haven't tried that but that looks like it would clear those tables completely vs. purging only the unused tables. Would following that with a syncdb then restore the content ty

Re: manage.py idea?

2007-08-15 Thread Collin Grady
Rob Hudson said the following: > Would it be worthwhile to add a way to purge unused content types via > manage.py? It could look at INSTALLED_APPS and anything not installed > it removes? Wouldn't reset do that? ./manage.py reset auth contenttypes -- Collin Grady "Die? I should say not, de

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Deryck Hodge
On 8/15/07, Deryck Hodge <[EMAIL PROTECTED]> wrote: > On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > I'd like to split this into several files, turning > > django.core.management into a package. The purest way of splitting the > > functionality would be to give each manage.py action ("

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Deryck Hodge
On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > I'd like to split this into several files, turning > django.core.management into a package. The purest way of splitting the > functionality would be to give each manage.py action ("runserver", > "syncdb", etc.) its own Python module, like th

Re: Taming management.py, the 1730-line behemoth

2007-08-15 Thread Adrian Holovaty
On 8/15/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > backends/ > __init__.py > runserver.py > sqlall.py > syncdb.py I wrote "backends" there, but I meant "commands", which would be a more meaningfu

Taming management.py, the 1730-line behemoth

2007-08-15 Thread Adrian Holovaty
In implementing the "manage.py testserver" command, I've been struck by how large django/core/management.py has gotten. It's 1730 lines long -- and messy. I'd like to split this into several files, turning django.core.management into a package. The purest way of splitting the functionality would

Re: manage.py idea?

2007-08-15 Thread Rob Hudson
PS: I should add before Malcolm tells me, "We accept patches" that I'm willing to code this up for submissions if the idea is generally well received. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django deve

manage.py idea?

2007-08-15 Thread Rob Hudson
One of the things I typically do when starting a new project/app is to spend some time adjusting and tweaking the data model. One thing I run into sometimes when I change my model name is leftover content types in the database and also in the permissions. It's a bit of a pain removing these manu

Re: Shouldn't _ be ugettext instead of gettext?

2007-08-15 Thread Christopher Lenz
Am 15.08.2007 um 16:52 schrieb Michael Radziej: > currently, django/conf/__init__.py still sets __builtins__['_'] = > gettext. > > This causes a UnicodeDecodeError in code like the following line > when the > the translated message contains non-ASCII characters: > > _('some message: %s').someM

Re: Shouldn't _ be ugettext instead of gettext?

2007-08-15 Thread Malcolm Tredinnick
Hey Michael, On Wed, 2007-08-15 at 16:52 +0200, Michael Radziej wrote: > Hi, > > currently, django/conf/__init__.py still sets __builtins__['_'] = gettext. > > This causes a UnicodeDecodeError in code like the following line when the > the translated message contains non-ASCII characters: > >

Shouldn't _ be ugettext instead of gettext?

2007-08-15 Thread Michael Radziej
Hi, currently, django/conf/__init__.py still sets __builtins__['_'] = gettext. This causes a UnicodeDecodeError in code like the following line when the the translated message contains non-ASCII characters: _('some message: %s').someModel.name Shouldn't _ better evaluate to ugettext? Michael

Re: testing broken

2007-08-15 Thread Malcolm Tredinnick
On Wed, 2007-08-15 at 04:15 +, SmileyChris wrote: > Recent checkin http://code.djangoproject.com/changeset/5887 broke > running an individual test: I've tried to fix the same problem (as intended by [5887]) in a different way in [5892] and [5893]. Regards, Malcolm -- No one is listening un

Re: Proposal: runserver --with-fixture

2007-08-15 Thread ludvig.ericson
On Aug 14, 11:19 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > On 8/14/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > > I would suggest that rather than trying to make the --with-fixture > > flag handle all this, it would be better to do this as a top level > > command, i.e.: > > > dj

Re: Newforms suggestions - pre_clean? magic cleaned_data? - access to errors?

2007-08-15 Thread sime
> It is simple, Pythonic and doesn't change core :-) Pythonic sure, but not even close to what I would consider simple. Surely we can find better, simpler, cleaner solutions to these common problems. I'll gather some code so we can all see what a mess these few trivial omissions are making. --~