Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I just committed the patch as r16964 [1]. Yay! Follow-up to other issues discussed in this thread: * #17042 [2] is tracking enhancements to startproject to allow specifying the target container directory (including CWD), and allowing it to write into

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Anssi Kääriäinen
On Oct 13, 8:33 am, Steven Cummings wrote: > So the situation I expect this to occur in is the context of very deliberate > coding by the programmer, e.g.: > > count = obj.save(where={'version': 1}) > > If the programmer forgets to check the count then they probably didn't > understand the feature

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Steven Cummings
On Wed, Oct 12, 2011 at 11:51 PM, Anssi Kääriäinen wrote: > > > My point is that we should never just return 0 if there is a > concurrent modification or some other reason for not being able to > persist the object state. Why? When you request obj.save() you are > requesting the object state to be

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Anssi Kääriäinen
On Oct 13, 5:40 am, Steven Cummings wrote: [About the 1/0 return value of .save()] > Well, obviously I hope it does have use in the original ticket that spawned > this one. I guess what I might need some help with here is: what are some of > the directions of the ORM that might affect this decisio

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Steven Cummings
On Wed, Oct 12, 2011 at 9:35 AM, Anssi Kääriäinen wrote: > On Oct 12, 4:47 pm, Steven Cummings wrote: > Then there is the possibility that some day we could support the > UNCHANGED return value. This would be actually cheap to do if Django > would support update of only changed fields. We couldn'

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Brett, On 10/12/2011 06:31 PM, Brett H wrote: > Having reworked project structures so many times I think creating the > outer folder 'site_root' with startproject is a bad idea. Making > startproject install manage.py in the current working directo

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Luke Plant
On 13/10/11 01:09, Carl Meyer wrote: >> Similar to what Russ and Luke are saying, I'd also prefer it if >> startproject dropped manage.py and the project Python package in the >> current working directory (with overwrite checks first). > > I remain -1 on CWD pollution by default; I haven't yet se

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Brett H
Having reworked project structures so many times I think creating the outer folder 'site_root' with startproject is a bad idea. Making startproject install manage.py in the current working directory is the best transitional solution until distutils2 becomes stable. Even though distutils2 is not re

Re: RFC: "universal" view decorators

2011-10-12 Thread Andre Terra
Definitely +1 on this idea. It seems to me like the cleanest solution yet proposed insofar as it provides the desired new functionality while requiring very little change for current code. Cheers, AT On Wed, Oct 12, 2011 at 5:31 PM, Donald Stufft wrote: > Sorry for the delay, > > Here's a possi

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Brett H
+1 on installing CWD. Integrates nicely with the virtualenvwrapper mkproject command. I have a much longer reasoning why startproject should not get into creating the outer folder which is effectively the distribution folder, and the domain of distribution packaging tools, so I'll follow this post

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Chris, On 10/12/2011 05:28 PM, Chris Beaven wrote: > Great job on getting the ball rolling on this, Carl! > > +1 on the whole idea Thanks! > Similar to what Russ and Luke are saying, I'd also prefer it if > startproject dropped manage.py and the

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Chris Beaven
Great job on getting the ball rolling on this, Carl! +1 on the whole idea Similar to what Russ and Luke are saying, I'd also prefer it if startproject dropped manage.py and the project Python package in the current working directory (with overwrite checks first). -- You received this message

Re: Cleaning up manage.py and import paths

2011-10-12 Thread ptone
On Oct 12, 7:59 am, Luke Plant wrote: >  $ mkdir foo >  $ cd foo >  $ hg init > >  # OK, now what am I going to put in it? Oh, a Django project. > > In fact, it might be good idea to encourage use of VCS by mentioning it. > If I remember SVN correctly, you would actually need to think about it

Re: RFC: "universal" view decorators

2011-10-12 Thread Donald Stufft
Sorry for the delay, Here's a possible method of handling the idea of adding the additional functionality of things like requiring logins to both FBV's and CBV's in a way that I feel is consistent with the methodologies of each of those types (decorators for FBV, Mixins for CBV). This also kee

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Markus, On 10/12/2011 10:30 AM, Markus Gattol wrote: > django-admin.py startproject would create site_root and project_root > put as this patch intends, one could always easily rename site_root to > whatever he wants. example.com is entirely decoup

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Markus Gattol
Carl, why not have django-admin.py startproject create a site_root directory and within it a project_root directory by default if issued from within e.g. example.com (the outermost container/directory e.g. a virtualenv): example.com <-- mkvirtualenv example.com; non-Python stuff somehow r

Re: Towards a more friendly NoReverseMatch

2011-10-12 Thread Wilfred Hughes
> >    >>> reverse('i_dont_exist') > >    NoReverseMatch: Reverse for 'i_dont_exist' with arguments '()' and > > keyword arguments '{}' not found. > > > In this case, it would be nicer to have something like: > > >    NoURLPattern: No patterns specified for 'i_dont_exist'. > > Just on this point, I

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Alec Taylor
Hmm, well maybe we need to survey current structures, I'd expect some constant (i.e. the settings.py file) On Wed, Oct 12, 2011 at 11:53 PM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi Alec, > > On 10/12/2011 06:38 AM, Alec Taylor wrote: >> Backwards compatibility i

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Luke, On 10/12/2011 08:59 AM, Luke Plant wrote: >> It's not so easy to explain why startproject can't just create the >> directory to contain all the bits it creates in the first place, instead >> of making me do it manually :-) > > I think there

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Donald Stufft
+1 mkdir project cd project git init django-admin.py startproject project Is basically what I already do, and either way it's not terrible hard to switch, but I think it makes a lot of sense to use CWD as the top level directory. On Wednesday, October 12, 2011 at 10:59 AM, Luke Plant wrot

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Luke Plant
On 12/10/11 15:06, Carl Meyer wrote: > > > On 10/12/2011 07:53 AM, Russell Keith-Magee wrote: >> I'm not convinced it's a bad idea. From an pedagogical perspective, >> it's easy to explain -- Make a directory to contain all the bits for >> your project, move into the directory, then bootstrap you

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Anssi Kääriäinen
On Oct 12, 4:47 pm, Steven Cummings wrote: > If you're ensuring a set of data from some other source, what's the use of > knowing what was new? Are there other concrete cases where this might be > useful? The standard use when synchronizing data is to make sure there aren't too many changes. This

Re: Towards a more friendly NoReverseMatch

2011-10-12 Thread Tom Evans
On Wed, Oct 12, 2011 at 12:56 PM, Wilfred Hughes wrote: > It would be really good if we could improve the errors provided when > Django can't do reverse(). > > For example: > >    >>> reverse('i_dont_exist') >    NoReverseMatch: Reverse for 'i_dont_exist' with arguments '()' and > keyword argument

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/12/2011 07:53 AM, Russell Keith-Magee wrote: > I'm not convinced it's a bad idea. From an pedagogical perspective, > it's easy to explain -- Make a directory to contain all the bits for > your project, move into the directory, then bootstrap yo

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Russell Keith-Magee
On Wed, Oct 12, 2011 at 9:23 PM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi Russ, > > On 10/12/2011 05:14 AM, Russell Keith-Magee wrote: >> My only feedback on the patch is a point of clarification in the >> tutorial. Rather than creating a mysite directory with a m

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Steven Cummings
-- Steven On Wed, Oct 12, 2011 at 8:07 AM, Anssi Kääriäinen wrote: > > Model.save() should return models.UPDATED or models.INSERTED. That is > more helpful than the 1/0 return value. For example you might want to > do different things if the model was inserted or updated in > application code. O

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Steven Cummings
-- Steven On Wed, Oct 12, 2011 at 5:37 AM, Johannes Dollinger wrote: > > Am 12.10.2011 um 03:35 schrieb Steven Cummings: > > Ticket #12086 is a duplicate. I don't think QuerySet.delete() should return > the number of all collected objects, but just the number of objects deleted > from QuerySe

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Steven Cummings
It is for now, but the ticket I'm building up to [1] is that it may actually be 0 if a precondition is not met. This is how your code can know if the current request really got to do a save or delete if two or more are trying to update the object at the same time. [1] https://code.djangoproject.co

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Brett, On 10/12/2011 07:11 AM, Brett H wrote: > Post 1.4 you actually might want to think a bit about integrating a > distutils2 setup.cfg into the manage.py folder and the startproject > command. Oh, I certainly have thought about it :-) A number

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Mateusz, On 10/12/2011 05:20 AM, Mateusz Harasymczuk wrote: > I suggest naming it src, and then having > > example.com > - contrib > - docs > - public > - src > - manage.py > - myapp > - __init__.py >

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Graham, On 10/12/2011 05:16 AM, Graham Dumpleton wrote: > Apache/mod_wsgi does not change the current working directory to be > where the WSGI file is located so that will not work for Apache/ > mod_wsgi. A sys.path modification would still be need

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Russ, On 10/12/2011 05:14 AM, Russell Keith-Magee wrote: > My only feedback on the patch is a point of clarification in the > tutorial. Rather than creating a mysite directory with a mysite > project directory in it, and then having to refer to the

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Karen, On 10/11/2011 06:21 PM, Karen Tracey wrote: > One thing that I think should be added before commit is a note in the > tutorial along the lines of "what if startproject didn't actually do > what we are saying it did?" and explaining that the

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Brett H
Moving the manage.py is a great move. Post 1.4 you actually might want to think a bit about integrating a distutils2 setup.cfg into the manage.py folder and the startproject command. Since distutils2 will be the standard in python3.3 for packaging and backported to python 2.5 it makes sense to le

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Anssi Kääriäinen
On Oct 12, 1:37 pm, Johannes Dollinger wrote: > Ticket #12086 is a duplicate. I don't think QuerySet.delete() should return > the number of all collected objects, but just the number of objects deleted > from QuerySet.model. Agree. A way to get the counts per object type would be useful (loggin

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Alec, On 10/12/2011 06:38 AM, Alec Taylor wrote: > Backwards compatibility is easily solved, include an upgrade.py file > which is called if project rootfolder has settings.py. upgrade.py > would fix the directory structure Thanks for the suggesti

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Alec Taylor
On Tue, Oct 11, 2011 at 9:05 AM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all, > > In the spirit of making Django behave better as a Python library (c.f. > Glyph's keynote at djangocon.us), I'd like to finally tackle removing > the sys.path hacks in django.core.ma

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Jeremy Dunck
On Mon, Oct 10, 2011 at 3:05 PM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 ... > 2. People write code that imports things inconsistently (sometimes with > the project prefix, sometimes without it), and then when they go to > deploy (without manage.py or setup_environ), th

Towards a more friendly NoReverseMatch

2011-10-12 Thread Wilfred Hughes
It would be really good if we could improve the errors provided when Django can't do reverse(). For example: >>> reverse('i_dont_exist') NoReverseMatch: Reverse for 'i_dont_exist' with arguments '()' and keyword arguments '{}' not found. In this case, it would be nicer to have something

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread rikuthero...@gmail.com
Hello, Sorry, it seems that I miss that last point. I'll try to re-read the contribution docs and work better in the proper way. Thanks and sorry again. 2011/10/12 Russell Keith-Magee > On Wed, Oct 12, 2011 at 5:37 PM, rikuthero...@gmail.com > wrote: > > Hello, > > > > As described on the tic

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Mateusz Harasymczuk
I suggest naming it src, and then having example.com - contrib - docs - public - src - manage.py - myapp - __init__.py - settings.py - urls.py - virtualenv -- You received this message because you are subscribed to the Googl

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread Russell Keith-Magee
On Wed, Oct 12, 2011 at 5:37 PM, rikuthero...@gmail.com wrote: > Hello, > > As described on the ticket [1], it seems that diveintopython.org is dead, so > I changed every occurence for  the mirror > http://diveintopython.nfshost.com/, that it seems to be the most updated. > The changes are on the

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Graham Dumpleton
On Oct 11, 9:05 am, Carl Meyer wrote: > What's the impact on adding a standard WSGI entrypoint? > - --- > > #16360 [5] has a patch to add a "wsgi.py" file to the default project, > which will serve as a standard WSGI entrypoint that can be used

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Russell Keith-Magee
On Tue, Oct 11, 2011 at 6:05 AM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all, > > In the spirit of making Django behave better as a Python library (c.f. > Glyph's keynote at djangocon.us), I'd like to finally tackle removing > the sys.path hacks in django.core.ma

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread rikuthero...@gmail.com
Those mirrors are from Dive into Python 3, is not the one linked from the Django docs. 2011/10/12 Dougal Matthews > Mirrors are appearing in a number of places for this and the html5 > version. Its hard to know which are more likely to stick around. > > http://diveintopython3.ep.io/ > https://g

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Johannes Dollinger
Am 12.10.2011 um 03:35 schrieb Steven Cummings: > Finally got around to these simple changes: > > * > https://github.com/estebistec/django/commit/b48a87afc324f5546b6654fa7638e406b397c0d6 > * > https://github.com/estebistec/django/commit/28ace32980b370fd17ae35019bfe8d055c673684 > > If the core

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread Dougal Matthews
Mirrors are appearing in a number of places for this and the html5 version. Its hard to know which are more likely to stick around. http://diveintopython3.ep.io/ https://github.com/diveintomark/diveintopython3 Dougal -- You received this message because you are subscribed to the Google Group

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread rikuthero...@gmail.com
Both have the content updated since 20 May 2004, so the content it's the same, and I think is better to have a smaller URL, and it has no header banner like the one from web.archive.org But as I said, the content is really the same, so there should be no problem changing it. 2011/10/12 Jeremy Dun

Re: #17028 - diveintopython.org links now dead

2011-10-12 Thread Jeremy Dunck
How about: http://web.archive.org/web/20110726001211/http://diveintopython.org/ ? On Wed, Oct 12, 2011 at 2:37 AM, rikuthero...@gmail.com wrote: > Hello, > > As described on the ticket [1], it seems that diveintopython.org is dead, so > I changed every occurence for  the mirror > http://diveintop

#17028 - diveintopython.org links now dead

2011-10-12 Thread rikuthero...@gmail.com
Hello, As described on the ticket [1], it seems that diveintopython.org is dead, so I changed every occurence for the mirror http://diveintopython.nfshost.com/, that it seems to be the most updated. The changes are on the patch attached in the ticket [2]. Best regards [1] https://code.djangopro

#16869 - BaseGenericInlineFormSet does not use form's save() method

2011-10-12 Thread rikuthero...@gmail.com
Hello, As described on the ticket [1], I attach a patch that changes the behaviour of "save_new" method in order to use the form's "save" method. Is the patch correct, or there's something to improve? Thanks in advance [1] https://code.djangoproject.com/ticket/16869 [2] https://code.djangoprojec

Re: Update on Ticket #16891: Delete/update should return number of rows modified

2011-10-12 Thread Florian Apolloner
Uhm question -- Does the count for Model.save() make any sense? Isn't that always one? Cheers, Florian -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-develo

Re: Cleaning up manage.py and import paths

2011-10-12 Thread holdenweb
On Oct 12, 9:31 am, Idan Gazit wrote: > This is fantastically clear and sensible. +1. > > I can't count the hours I've lost either chasing PYTHONPATH issues or > helping nontechnical people work around them so they could deploy their > newly-minted thing. I would agree that this is a well-thought

Re: Cleaning up manage.py and import paths

2011-10-12 Thread Idan Gazit
This is fantastically clear and sensible. +1. I can't count the hours I've lost either chasing PYTHONPATH issues or helping nontechnical people work around them so they could deploy their newly-minted thing. I -- You received this message because you are subscribed to the Google Groups "Djan