Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick


On Thu, 2008-11-13 at 17:06 -0800, Brandon Taylor wrote:
> Hi everyone,
> 
> Gerard's suggestion worked. Moving the pattern into a separate
> definition fixed it. But, I couldn't explain why :)

Then there's some kind of bug there. :-(

Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor

Hi everyone,

Gerard's suggestion worked. Moving the pattern into a separate
definition fixed it. But, I couldn't explain why :)

Many thanks!
Brandon

On Nov 13, 6:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote:
> > Hmm... Why in template tag you wrote `conversions` as view name but in
> > error traceback there is `my_site.conversions`?
>
> Because the error reporting from URL resolution is retarded. :-(
>
> The last thing it tries is . and that's what
> it reports, even though you might not even have project_name on the path
> and  might be a name specified explicitly (it's trying to
> see if it's the name of a view function, rather than a name="..." name).
>
> I have a bunch of uncommitted changes to improve that state of affairs,
> but there are a few corner cases, so it hasn't been committed yet.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick


On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote:
> Hmm... Why in template tag you wrote `conversions` as view name but in
> error traceback there is `my_site.conversions`?

Because the error reporting from URL resolution is retarded. :-(

The last thing it tries is . and that's what
it reports, even though you might not even have project_name on the path
and  might be a name specified explicitly (it's trying to
see if it's the name of a view function, rather than a name="..." name).

I have a bunch of uncommitted changes to improve that state of affairs,
but there are a few corner cases, so it hasn't been committed yet.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Alex Koshelev
Hmm... Why in template tag you wrote `conversions` as view name but in error
traceback there is `my_site.conversions`?


On Thu, Nov 13, 2008 at 06:27, Brandon Taylor <[EMAIL PROTECTED]>wrote:

>
> Hi everyone,
>
> So I have a question/problem with a named URL pattern...
>
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
>
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
>
> Some text
>
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
>
> What am I doing wrong?
>
> Kind regards,
> Brandon
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Gerard flanagan

Brandon Taylor wrote:
> Hi everyone,
> 
> So I have a question/problem with a named URL pattern...
> 
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
> 
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
> 
> Some text
> 
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
> 
> What am I doing wrong?
> 

Hi Brandon,

I had a similar problem, indeed for the same regex: [-\w]+

What happens if you add the problem url in a separate patterns list, 
something like:

from django.conf.urls.defaults import *

urlpatterns = patterns('',

)

urlpatterns += patterns('my_site.views',
   url(r'^resources/conversions/(?P[-\w]+)/$', 
'conversions', name='conversions'),
   )

This seemed to fix things for me (in fact using an 'include').

G.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor

Hi Chris,

Unfortunately, that doesn't work either. I guess I can just pass in a
dictionary of my local_variables and do them that way. A little
kludgy, but I guess it's not that bad, if that's what I have to do.

On Nov 13, 3:04 am, Chris Emerson <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 13, 2008 at 02:56:26PM +1100, Malcolm Tredinnick wrote:
> > On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> > > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> > > <[EMAIL PROTECTED]> wrote:
>
> > > Hi everyone,
>
> > > So I have a question/problem with a named URL pattern...
>
> > > #urls.py
> > > url(r'^resources/conversions/(?P[-\w]+)/$',
> > > 'my_site.views.conversions', name='conversions'),
> > [...]
>
> > > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > > but you are trying to match something with dashes in it.
>
> > That isn't the issue. The pattern is [-\w], which will also match
> > dashes. I'm not sure what is going wrong yet, though, since it looks
> > like it should be working.
>
> Shouldn't it be {% url conversions conversion_template="..." %}, ie
> using a keyword argument rather than positional?
>
> Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-13 Thread Chris Emerson

On Thu, Nov 13, 2008 at 02:56:26PM +1100, Malcolm Tredinnick wrote:
> On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> > <[EMAIL PROTECTED]> wrote:
> > 
> > Hi everyone,
> > 
> > So I have a question/problem with a named URL pattern...
> > 
> > #urls.py
> > url(r'^resources/conversions/(?P[-\w]+)/$',
> > 'my_site.views.conversions', name='conversions'),
> [...]
> 
> > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > but you are trying to match something with dashes in it.
> 
> That isn't the issue. The pattern is [-\w], which will also match
> dashes. I'm not sure what is going wrong yet, though, since it looks
> like it should be working.

Shouldn't it be {% url conversions conversion_template="..." %}, ie
using a keyword argument rather than positional?

Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 10:56 PM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
> > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > but you are trying to match something with dashes in it.
>
> That isn't the issue. The pattern is [-\w], which will also match
> dashes. I'm not sure what is going wrong yet, though, since it looks
> like it should be working.
>

Oh, right.  Time to get some glasses, apparently.
Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Brandon Taylor

Hi Malcom and Karen,

It will work if I pass the value for "conversion_template" as a
context variable, but not when setting it by hand. I'm not sure what
the difference is between that and simply saying {% url name
"my_value" %}

On Nov 12, 9:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> > <[EMAIL PROTECTED]> wrote:
>
> >         Hi everyone,
>
> >         So I have a question/problem with a named URL pattern...
>
> >         #urls.py
> >         url(r'^resources/conversions/(?P[-\w]+)/$',
> >         'my_site.views.conversions', name='conversions'),
>
> [...]
>
> > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > but you are trying to match something with dashes in it.
>
> That isn't the issue. The pattern is [-\w], which will also match
> dashes. I'm not sure what is going wrong yet, though, since it looks
> like it should be working.
>
> Regards,
> Malcolm
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Malcolm Tredinnick


On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote:
> On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor
> <[EMAIL PROTECTED]> wrote:
> 
> Hi everyone,
> 
> So I have a question/problem with a named URL pattern...
> 
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
[...]

> The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> but you are trying to match something with dashes in it.

That isn't the issue. The pattern is [-\w], which will also match
dashes. I'm not sure what is going wrong yet, though, since it looks
like it should be working.

Regards,
Malcolm

> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor <[EMAIL PROTECTED]>wrote:

>
> Hi everyone,
>
> So I have a question/problem with a named URL pattern...
>
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
>
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
>
> Some text
>
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
>
> What am I doing wrong?
>
>
The \w in your specifier for conversion_template matches [a-zA-Z0-9_] but
you are trying to match something with dashes in it.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---