Re: Feature proposal: escape hatch for colliding template syntax in django templates

2010-10-20 Thread David Danier
> If we're going to do this, could we also look at deprecating the > 'templatetag' template tag? There are a couple cases a 'verbatim' tag > wouldn't cover that 'templatetag' wouldn't, but I'm kinda hard-pressed > to think of when they'd ever come up in reality. +1 for this. I for one don't even u

Re: Feature proposal: escape hatch for colliding template syntax in django templates

2010-10-20 Thread Andrew Godwin
On 20/10/10 02:40, Stephen Kelly wrote: Sorry. Sent too early. All thumbs today. Consider these examples: {% verbatim "%} %}" %} (That is, "%} %}" in a verbatim-no-end tag) {% verbatim %} %} %} {% endverbatim %} (That is, " %} %} " wrapped in verbatim tags) The current lexer uses regexps to

Re: new class based views

2010-10-20 Thread Valentin Golev
Awesome, thank you! I've asked about @login_required and class based views in django-users, and I'd like to ask here: are something like LoginRequiredMixin's planned? -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK

Ordering Check in django/core/management/validation.py

2010-10-20 Thread Klaas van Schelven
Hi, I'm not sure I'm following protocol here, but here it goes... django/core/management/validation.py, both in the current trunk and in 1.2.3 It says in the accompanying comment: # Skip ordering in the format field1__field2 (FIXME: checking # this format would be

Re: new class based views

2010-10-20 Thread Russell Keith-Magee
On Wed, Oct 20, 2010 at 6:01 PM, Valentin Golev wrote: > Awesome, thank you! > > I've asked about @login_required and class based views in > django-users, and I'd like to ask here: are something like > LoginRequiredMixin's planned? No, nothing like that is planned. This is a situation were decora

Re: Ordering Check in django/core/management/validation.py

2010-10-20 Thread Russell Keith-Magee
On Wed, Oct 20, 2010 at 6:43 PM, Klaas van Schelven wrote: > Hi, > > I'm not sure I'm following protocol here, but here it goes... The best way to report this is to open a ticket [1] which describes the problem in detail (which is what you've done here). This ensure that we have a formal way of t

Re: new class based views

2010-10-20 Thread Valentin Golev
As far as I know, I can just say: @login_required class MyView(View): # ... since it will wrap __init__ I need either to create a decorator for decorators: @on_dispatch(login_required) class MyView(View): or decorate result of MyView().as_view(). Maybe I'm wrong. I think it will be great to

Re: new class based views

2010-10-20 Thread Valentin Golev
Almost everything I'm talking about right now is from this thread: http://groups.google.com/group/django-users/browse_frm/thread/5239e284b5c285d5/a2676f257d37cf85#a2676f257d37cf85 ("login_required and new class based views" in django-users in case the link doesnt work.) -- Best Regards, Valentin

Re: new class based views

2010-10-20 Thread Russell Keith-Magee
On Wed, Oct 20, 2010 at 7:05 PM, Valentin Golev wrote: > As far as I know, I can just say: > > @login_required > class MyView(View): >   # ... > > since it will wrap __init__ > > I need either to create a decorator for decorators: > @on_dispatch(login_required) > class MyView(View): > > or decorat

Re: new class based views

2010-10-20 Thread Valentin Golev
I think class decorator for views only is a great idea, because it will be: a) just like with old view functions decorators b) does not require any method overrides/imports into urls.py/explicit transformations in views.py I'd like Django to have a decorator for turning old decorators into decora

Re: Feature proposal: escape hatch for colliding template syntax in django templates

2010-10-20 Thread Johannes Dollinger
Am 20.10.2010 um 10:40 schrieb Andrew Godwin: > On 20/10/10 02:40, Stephen Kelly wrote: >> Sorry. Sent too early. All thumbs today. Consider these examples: >> >> {% verbatim "%} %}" %} >> >> (That is, "%} %}" in a verbatim-no-end tag) >> >> {% verbatim %} %} %} {% endverbatim %} >> >> (That

Re: Model proxy instance does not equal the respective model instance

2010-10-20 Thread Byron
Continuing from... http://code.djangoproject.com/ticket/14492 > the real issue here is "What is a Proxy", and "what is equality" I agree, that is the real issue. I based most of my reasoning off of what the docs already state in that a proxy model can be written to extend the behavior of the mode

Re: new class based views

2010-10-20 Thread Luke Plant
On Wed, 2010-10-20 at 19:25 +0800, Russell Keith-Magee wrote: > A class decorator (and/or a wrapper function for turning decorators > into class decorators) is also an interesting idea. An argument against this is "one way to do it". If I look at a class and want to know what decorators are app

Re: new class based views

2010-10-20 Thread Łukasz Rekucki
On 20 October 2010 15:59, Luke Plant wrote: > On Wed, 2010-10-20 at 19:25 +0800, Russell Keith-Magee wrote: > >> A class decorator (and/or a wrapper function for turning decorators >> into class decorators) is also an interesting idea. > > An argument against this is "one way to do it".  If I look

Re: new class based views

2010-10-20 Thread Valentin Golev
Well, since we are already using class Mixins for extending View functionality, we can try to turn decorators into mixins. Having two ways to add some functionality to class (decorators and mixins) can be somewhat uncomfortable. I had some doubts if mixins can act as a "wrappers" to defined functi

Re: new class based views

2010-10-20 Thread Russell Keith-Magee
On Wed, Oct 20, 2010 at 9:59 PM, Luke Plant wrote: > On Wed, 2010-10-20 at 19:25 +0800, Russell Keith-Magee wrote: > >> A class decorator (and/or a wrapper function for turning decorators >> into class decorators) is also an interesting idea. > > An argument against this is "one way to do it".  If

Re: new class based views

2010-10-20 Thread Łukasz Rekucki
Created a ticket for this: http://code.djangoproject.com/ticket/14512 On 20 October 2010 16:13, Russell Keith-Magee wrote: > On Wed, Oct 20, 2010 at 9:59 PM, Luke Plant wrote: >> On Wed, 2010-10-20 at 19:25 +0800, Russell Keith-Magee wrote: >> >>> A class decorator (and/or a wrapper function for

Re: Ordering Check in django/core/management/validation.py

2010-10-20 Thread Klaas van Schelven
http://code.djangoproject.com/ticket/14513 Now give me my bonus points :-) On Oct 20, 1:05 pm, Russell Keith-Magee wrote: > On Wed, Oct 20, 2010 at 6:43 PM, Klaas van Schelven > > wrote: > > Hi, > > > I'm not sure I'm following protocol here, but here it goes... > > The best way to report this

Proposal: A better way to handle unic�de in messag es, etc

2010-10-20 Thread Yo-Yo Ma
I was trying some things out, and I noticed that it isn't actually possible (without using a char-code and converting it) to put something like ° (degree symbol) into a "message". Example: this code: messages.info(request, request.GET.get('symbol')) with this URL: http://127.0.0.1:8080/?symbol=%

contrib.staticfiles app concerns

2010-10-20 Thread Waldemar Kornewald
Hi, first of all, sorry for chiming in so late. It seems like this has been discussed in May, already, but I didn't follow the discussion back then. Today the staticfiles contrib app was committed to trunk. This got me wondering: Wasn't there recently a discussion about how "contrib" is a bad idea

Re: new class based views

2010-10-20 Thread Luke Plant
On Wed, 2010-10-20 at 16:05 +0200, Łukasz Rekucki wrote: > OTOH, it's annoying to have to write an dispatch() method with a super > inside (which effectively does nothing), just to apply a decorator. That's a good point I hadn't thought of, as are Russell's other points. Just to put it on the ta

Re: Proposal: A better way to handle unicode in messages, etc

2010-10-20 Thread Luke Plant
On Wed, 2010-10-20 at 09:50 -0700, Yo-Yo Ma wrote: > I was trying some things out, and I noticed that it isn't actually > possible (without using a char-code and converting it) to put > something like ° (degree symbol) into a "message". > > Example: > > this code: > messages.info(request, request

Re: Proposal: A better way to handle unicode in messages, etc

2010-10-20 Thread Michael
request.GET should convert %codes into their appropriate characters, the problem is likely that messages.info is expecting an ascii string, not unicode. messages.info(request, unicode(request.GET.get('symbol'), errors='replace')) Will replace the degree symbol with a ?, if I remember correctly.

Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Mikhail Korobov
Hi all, I'm talking about this ticket: http://code.djangoproject.com/ticket/12816 With class-based views landed and the deprecation of django.views.generic.simple (and direct_to_template in particular) there won't be simple and undeprecated shortcut for render_to_response. So please add the 'ren

Re: contrib.staticfiles app concerns

2010-10-20 Thread Carl Meyer
Hi Waldemar, On Oct 20, 1:40 pm, Waldemar Kornewald wrote: [snip] > However, what staticfiles does has almost nothing to do with "bigger > project" asset management. Just look at the features grid on > djangopackages (disclaimer: I'm the author of django-mediagenerator > and I maintain that grid)

Re: Field localize useless

2010-10-20 Thread Chris Cogdon
That's probably a poor example. Australian postcodes should be a StringField with a validation constraint ensuring that its 4 digits. Why? Well, there are australian postcodes that start with 0 - Northern Territory - and they're not going to be displayed correctly with ANY reasonable localisation

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Jacob Kaplan-Moss
On Wed, Oct 20, 2010 at 1:48 PM, Mikhail Korobov wrote: > So please add the 'render' shortcut in 1.3. It's one of the things on my list. If you'd like to make it happen faster, a patch + tests would make it a no-brainer for me. Jacob -- You received this message because you are subscribed to t

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Mikhail Korobov
That's great! I'll mark the ticket as assigned for me then. There is an unresolved question in the ticket: "The only hesitation is the relationship with #12815; we should resolve that decision before committing anything for this ticket." #12815 is about introducing TemplateResponse. Is the patch

Re: contrib.staticfiles app concerns

2010-10-20 Thread Sean Bleier
I agree with Carl, > Staticfiles has a very specific, well-defined purpose (collecting media > files from apps), which fills a major hole in the Django "story" for > reusable apps. IMHO contrib apps should have the following characteristics (and probably more): * Solves a problem that can be des

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Jacob Kaplan-Moss
2010/10/20 Mikhail Korobov : > There is an unresolved question in the ticket: "The only hesitation is > the relationship with #12815; we should resolve that decision before > committing anything for this ticket." > > #12815 is about introducing TemplateResponse. Is the patch with > 'render' shortcu

Re: contrib.staticfiles app concerns

2010-10-20 Thread Waldemar Kornewald
Hi Carl, On Wed, Oct 20, 2010 at 8:55 PM, Carl Meyer wrote: > Hi Waldemar, > > On Oct 20, 1:40 pm, Waldemar Kornewald wrote: > [snip] >> However, what staticfiles does has almost nothing to do with "bigger >> project" asset management. Just look at the features grid on >> djangopackages (disclai

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Łukasz Rekucki
On 20 October 2010 21:57, Jacob Kaplan-Moss wrote: > 2010/10/20 Mikhail Korobov : >> There is an unresolved question in the ticket: "The only hesitation is >> the relationship with #12815; we should resolve that decision before >> committing anything for this ticket." >> >> #12815 is about introdu

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Mikhail Korobov
I think the correct ticket is http://code.djangoproject.com/ticket/9081 and it is in 'almost-wontfix' state now. Yes, it's a great time to either move it to wontfix or mark as accepted and implement alongside with the render shortcut. On 21 окт, 02:05, Łukasz Rekucki wrote: > On 20 October 2010 2

Re: contrib.staticfiles app concerns

2010-10-20 Thread Jacob Kaplan-Moss
On Wed, Oct 20, 2010 at 3:04 PM, Waldemar Kornewald wrote: > I wish that were the case. The staticfiles documentation says: > > """ > Remember to run :djadmin:`collectstatic` when your media changes; > the view only serves static files that have been collected. > """ I actually wrote that without

Re: Model proxy instance does not equal the respective model instance

2010-10-20 Thread Gabriel Hurley
Speaking on a semantic level, a "proxy" is a stand-in acting on behalf of (or in place of) another entity. There is an implied near- equivalence, but inherent in the idea of a proxy is that it is *not* the same as the original. As in the case of assigning a proxy to vote for you in corporate electi

Re: contrib.staticfiles app concerns

2010-10-20 Thread Carl Meyer
Hi Waldemar, On Oct 20, 4:04 pm, Waldemar Kornewald wrote: > In what way does staticfiles make writing reusable apps easier? It > merely collects apps' "static" folders. The same thing could be > achieved by defining a simple standard: > "Put media files in the 'media' folder." > and then making

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Ivan Sagalaev
On 10/20/2010 11:51 PM, Mikhail Korobov wrote: #12815 is about introducing TemplateResponse. Is the patch with 'render' shortcut returning just HttpResponse acceptable? I think that TemplateResponse is less useful after class-based views make their way into trunk so 'render' shortcut shouldn't bo

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Mikhail Korobov
Hi Ivan! On 21 окт, 03:00, Ivan Sagalaev wrote: > > Wait!!! > > Sorry… Hello everyone :-) > > If I remember correctly TemplateResponse was solving a problem of some > middleware wanting to mess with a view context before it's baked into > final string representation. This would solve in a good wa

Admin sends out potentially harmful m2m_changed signals

2010-10-20 Thread Gabriel Hurley
I'd like to call attention to ticket #6707 [1], which deals with the implementation of ReverseManyRelatedObjectsDescriptor.__set__. Specifically, the problem is that the current implentation takes a very efficient "clear everything and add all the keys back in" approach to managing these relationsh

Re: Admin sends out potentially harmful m2m_changed signals

2010-10-20 Thread Gabriel Hurley
I see that this issue was also discussed in #13022 [5], wherein Russ argued that the current signals are technically correct but that solving #6707 would be worthwhile *if* it could be done efficiently. [5] http://code.djangoproject.com/ticket/13022 On Oct 20, 2:45 pm, Gabriel Hurley wrote: > I'

generic view fail fast

2010-10-20 Thread Sean Brant
One benefit with function based views that is lost with generic views is bailing (returning early) conditionally. Say you have a view returns its response if a condition is meet otherwise does some more possible expensive stuff and then returns. Its nice to bail and avoid the expensive stuff. Im n

Re: contrib.staticfiles app concerns

2010-10-20 Thread Waldemar Kornewald
Hi Carl, On Wed, Oct 20, 2010 at 10:53 PM, Carl Meyer wrote: > Hi Waldemar, > > On Oct 20, 4:04 pm, Waldemar Kornewald wrote: >> That's a funny combination of tools. :) >> You don't really need django-staticfiles because in your case >> django_compressor takes care of collecting assets (i.e. it

Re: contrib.staticfiles app concerns

2010-10-20 Thread Waldemar Kornewald
On Wed, Oct 20, 2010 at 10:13 PM, Jacob Kaplan-Moss wrote: > On Wed, Oct 20, 2010 at 3:04 PM, Waldemar Kornewald > wrote: >> I wish that were the case. The staticfiles documentation says: >> >> """ >> Remember to run :djadmin:`collectstatic` when your media changes; >> the view only serves static

#14512: Decorating class based views (was Re: new class based views)

2010-10-20 Thread Łukasz Rekucki
On 20 October 2010 19:42, Luke Plant wrote: > On Wed, 2010-10-20 at 16:05 +0200, Łukasz Rekucki wrote: > >> OTOH, it's annoying to have to write an dispatch() method with a super >> inside (which effectively does nothing), just to apply a decorator. > > That's a good point I hadn't thought of, as

Re: Proposal: A better way to handle unic�de in me ssages, etc

2010-10-20 Thread Russell Keith-Magee
On Thu, Oct 21, 2010 at 12:50 AM, Yo-Yo Ma wrote: > I was trying some things out, and I noticed that it isn't actually > possible (without using a char-code and converting it) to put > something like ° (degree symbol) into a "message". Sure. Sounds like a bug to me. If you can't call a Django met

Re: new class based views

2010-10-20 Thread Russell Keith-Magee
On Thu, Oct 21, 2010 at 1:42 AM, Luke Plant wrote: > On Wed, 2010-10-20 at 16:05 +0200, Łukasz Rekucki wrote: > >> OTOH, it's annoying to have to write an dispatch() method with a super >> inside (which effectively does nothing), just to apply a decorator. > > That's a good point I hadn't thought

Re: contrib.staticfiles app concerns

2010-10-20 Thread Ian Lewis
On Thu, Oct 21, 2010 at 2:40 AM, Waldemar Kornewald wrote: > Today the staticfiles contrib app was committed to trunk. This got me > wondering: Wasn't there recently a discussion about how "contrib" is a > bad idea and all apps should either be in core or live as separate > projects? Is staticfile

Re: contrib.staticfiles app concerns

2010-10-20 Thread Jannis Leidel
Ian, > I thought about this too and had a long thread on Twitter with jezdez about > staticfiles. It occurred to me that adding more apps to contrib was kind of a > bad idea. I know "everyone" uses admin etc. but I was of the understanding > that contrib apps are optional apps for django but st

Re: Model proxy instance does not equal the respective model instance

2010-10-20 Thread Tai Lee
I think that since Proxy models only affect the methods, properties and way the data is used (not the actual underlying data itself), it is appropriate to compare User and UserProxy as equal. To not treat them as equal, you will need to be sure that you never pass a UserProxy object to a 3rd party

Re: Proposal: A better way to handle unic de in messages, etc

2010-10-20 Thread Yo-Yo Ma
Thanks, I'll do that in the morning with a traceback, and steps to reproduce it. On Oct 20, 6:15 pm, Russell Keith-Magee wrote: > On Thu, Oct 21, 2010 at 12:50 AM, Yo-Yo Ma wrote: > > I was trying some things out, and I noticed that it isn't actually > > possible (without using a char-code and c

Re: Error email flooding on high traffic production sites

2010-10-20 Thread Simon Litchfield
On Sep 30, 8:47 pm, Andrew Wilkinson wrote: > I have a patch in the bug tracker that fixes this exact problem > -http://code.djangoproject.com/ticket/11565. The patch is just over a > year old now so it might not apply that cleanly to the current trunk. Revised patch here (against r13296) -- htt

Re: contrib.staticfiles app concerns

2010-10-20 Thread Ian Lewis
On Thu, Oct 21, 2010 at 12:25 PM, Jannis Leidel wrote: > Ian, > > > I thought about this too and had a long thread on Twitter with jezdez > about staticfiles. It occurred to me that adding more apps to contrib was > kind of a bad idea. I know "everyone" uses admin etc. but I was of the > understa

Re: Gentle Proposal: add 'render' shortcut in 1.3

2010-10-20 Thread Ivan Sagalaev
On 10/21/2010 01:39 AM, Mikhail Korobov wrote: 1. Developer writes a view and want to reuse it (e.g. change the context). My assumptions was: a) Class based views are now the recommended way to write reusable views This is where our views differ. I have to admit that I didn't follow closely t