Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Alex Gaynor
On Sat, Apr 11, 2009 at 7:24 PM, Malcolm Tredinnick <
malc...@pointy-stick.com> wrote:

>
> On Sat, 2009-04-11 at 19:23 -0400, Alex Gaynor wrote:
> [...]
> >
> >
> > Even if your application is exclusively for your own usage, it's not
> > uncommon for the pointy haired boss to come in with requests to change
> > a URL hierarchy, and there's no reason to create more work for
> > yourself.
>
> Which is what James wrote, right?
>
> Malcolm
>
>
>
> >
>
Well talked about the generic, "change the URL it's deployed at" case, you
mentioned that for an application you distribute this is especially
important.  I just wanted to note that it's very true even if that's not the
case.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Malcolm Tredinnick

On Sat, 2009-04-11 at 19:23 -0400, Alex Gaynor wrote:
[...]
> 
> 
> Even if your application is exclusively for your own usage, it's not
> uncommon for the pointy haired boss to come in with requests to change
> a URL hierarchy, and there's no reason to create more work for
> yourself.

Which is what James wrote, right?

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Alex Gaynor
On Sat, Apr 11, 2009 at 7:21 PM, Malcolm Tredinnick <
malc...@pointy-stick.com> wrote:

>
> On Sat, 2009-04-11 at 17:49 -0500, James Bennett wrote:
> > On Sat, Apr 11, 2009 at 5:13 PM, codecowboy  wrote:
> > > I've followed some examples from around the Django community and that
> > > is why I use the reverse() method at all.  What is the point of using
> > > the reverse() method?
> >
> > Well, there's a problem you'll run into fairly often.
> >
> > Suppose, for example, that you set up a weblog, and you have it at the
> > URL "/weblog/". So in your templates you have links to "/weblog/", in
> > your code the get_absolute_url() method of entries returns a string
> > containing "/weblog/", any redirects involved have to have "/weblog/"
> > in the URL, etc.
> >
> > And then one day you suddenly need to deploy another copy of the
> > appliation, but on a site which wants the weblog at "/blog/".
>
> As James is well aware, but I'd like to make it explicit: This is
> particularly true if you're writing an application that is going to be
> distributed and used by a broader audience. You have absolutely no idea
> where the end-users are going to install your application in the their
> URL hierarchy. Tying your application to some particular URLs is simply
> poor design practice in those cases.
>
> Regards,
> Malcolm
>
>
> >
>
Even if your application is exclusively for your own usage, it's not
uncommon for the pointy haired boss to come in with requests to change a URL
hierarchy, and there's no reason to create more work for yourself.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Malcolm Tredinnick

On Sat, 2009-04-11 at 17:49 -0500, James Bennett wrote:
> On Sat, Apr 11, 2009 at 5:13 PM, codecowboy  wrote:
> > I've followed some examples from around the Django community and that
> > is why I use the reverse() method at all.  What is the point of using
> > the reverse() method?
> 
> Well, there's a problem you'll run into fairly often.
> 
> Suppose, for example, that you set up a weblog, and you have it at the
> URL "/weblog/". So in your templates you have links to "/weblog/", in
> your code the get_absolute_url() method of entries returns a string
> containing "/weblog/", any redirects involved have to have "/weblog/"
> in the URL, etc.
> 
> And then one day you suddenly need to deploy another copy of the
> appliation, but on a site which wants the weblog at "/blog/".

As James is well aware, but I'd like to make it explicit: This is
particularly true if you're writing an application that is going to be
distributed and used by a broader audience. You have absolutely no idea
where the end-users are going to install your application in the their
URL hierarchy. Tying your application to some particular URLs is simply
poor design practice in those cases.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread James Bennett

On Sat, Apr 11, 2009 at 5:13 PM, codecowboy  wrote:
> I've followed some examples from around the Django community and that
> is why I use the reverse() method at all.  What is the point of using
> the reverse() method?

Well, there's a problem you'll run into fairly often.

Suppose, for example, that you set up a weblog, and you have it at the
URL "/weblog/". So in your templates you have links to "/weblog/", in
your code the get_absolute_url() method of entries returns a string
containing "/weblog/", any redirects involved have to have "/weblog/"
in the URL, etc.

And then one day you suddenly need to deploy another copy of the
appliation, but on a site which wants the weblog at "/blog/".

Reverse URL resolution lets you easily make this kind of change, or
have an application reused on different sites without changing the
code, by looking up the correct URL in your actual URL configuration
instead of hard-coding it all over the place.

But in order to work, all your URL patterns have to point to views
which actually exist and which live in files that don't raise any kind
of import or syntax errors, since the reverse resolution system has to
scan through your URL patterns to find the right one. If you have any
errors in a view file, or have a URL pattern pointing to a view that
doesn't actually exist in your code, reverse resolution won't work.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Mike Ramirez
On Saturday 11 April 2009 03:13:18 pm codecowboy wrote:
> What is the point of using the reverse() method?
>

I'm answering this because I want to make sure that my idea of it is the same 
as the rest of the community and would definately like feedback on it.


Using this example:

urlpatterns = patterns ('fun', 
url(r'^fun/$', 'views.place', name="fun_place"),
)

reverse('fun_place') will return the url, in this case, 'fun/'.

I use reverse in various view functions and other places, such as http 
redirects. To me it's a lot like the models.permalink decorator on non-model 
based urls and fits in with the DRY philosophy. 

Using this style in your code allows you to edit the the url pattern, or the 
funciton call, or any other part of the url pattern without ever having to 
change anything else in your code, unless you edit the name parameter.  


Mike
 


-- 
Mark's Dental-Chair Discovery:
Dentists are incapable of asking questions that require a
simple yes or no answer.


signature.asc
Description: This is a digitally signed message part.


Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread codecowboy

I've followed some examples from around the Django community and that
is why I use the reverse() method at all.  What is the point of using
the reverse() method?

On Apr 11, 5:03 pm, Daniel Roseman 
wrote:
> On Apr 11, 7:57 pm, codecowboy  wrote:
>
>
>
> > Every time that a load a form on my site, I see the following errors.
> > If I reload the page, they go away and everything works just fine.
> > Does anyone know why?  Thank you in advance.
>
> > TemplateSyntaxError at /eaccounts/register/
>
> > Caught an exception while rendering: Tried edit in module
> > conferences.views. Error was: 'module' object has no attribute 'edit'
>
> > Original Traceback (most recent call last):
> >   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> > line 71, in render_node
> >     result = node.render(context)
> >   File "/usr/lib/python2.5/site-packages/django/template/
> > defaulttags.py", line 373, in render
> >     url = reverse(self.view_name, args=args, kwargs=kwargs)
> >   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> > line 254, in reverse
> >     *args, **kwargs)))
> >   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> > line 227, in reverse
> >     possibilities = self.reverse_dict.getlist(lookup_view)
> >   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> > line 169, in _get_reverse_dict
> >     self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
> >   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> > line 136, in _get_callback
> >     raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" %
> > (func_name, mod_name, str(e))
> > ViewDoesNotExist: Tried edit in module conferences.views. Error was:
> > 'module' object has no attribute 'edit'
>
> The page you are trying to load has either a reverse() call in the
> view, or a {% url %} tag in the template. In order to resolve the
> reverse lookup, Django is trying to load all the views in your urlconf
> - and it looks like one of them has an error. Fix the error in the
> conferences.views.edit function, and the message should go away.
> --
> DR.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Daniel Roseman

On Apr 11, 7:57 pm, codecowboy  wrote:
> Every time that a load a form on my site, I see the following errors.
> If I reload the page, they go away and everything works just fine.
> Does anyone know why?  Thank you in advance.
>
> TemplateSyntaxError at /eaccounts/register/
>
> Caught an exception while rendering: Tried edit in module
> conferences.views. Error was: 'module' object has no attribute 'edit'
>
> Original Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 71, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.5/site-packages/django/template/
> defaulttags.py", line 373, in render
>     url = reverse(self.view_name, args=args, kwargs=kwargs)
>   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> line 254, in reverse
>     *args, **kwargs)))
>   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> line 227, in reverse
>     possibilities = self.reverse_dict.getlist(lookup_view)
>   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> line 169, in _get_reverse_dict
>     self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
>   File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
> line 136, in _get_callback
>     raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" %
> (func_name, mod_name, str(e))
> ViewDoesNotExist: Tried edit in module conferences.views. Error was:
> 'module' object has no attribute 'edit'

The page you are trying to load has either a reverse() call in the
view, or a {% url %} tag in the template. In order to resolve the
reverse lookup, Django is trying to load all the views in your urlconf
- and it looks like one of them has an error. Fix the error in the
conferences.views.edit function, and the message should go away.
--
DR.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread codecowboy

Every time that a load a form on my site, I see the following errors.
If I reload the page, they go away and everything works just fine.
Does anyone know why?  Thank you in advance.

TemplateSyntaxError at /eaccounts/register/

Caught an exception while rendering: Tried edit in module
conferences.views. Error was: 'module' object has no attribute 'edit'

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/
defaulttags.py", line 373, in render
url = reverse(self.view_name, args=args, kwargs=kwargs)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 169, in _get_reverse_dict
self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 136, in _get_callback
raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" %
(func_name, mod_name, str(e))
ViewDoesNotExist: Tried edit in module conferences.views. Error was:
'module' object has no attribute 'edit'

Request Method: GET
Request URL:http://127.0.0.1:8000/eaccounts/register/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: Tried edit in module
conferences.views. Error was: 'module' object has no attribute 'edit'

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/
defaulttags.py", line 373, in render
url = reverse(self.view_name, args=args, kwargs=kwargs)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 169, in _get_reverse_dict
self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 136, in _get_callback
raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" %
(func_name, mod_name, str(e))
ViewDoesNotExist: Tried edit in module conferences.views. Error was:
'module' object has no attribute 'edit'

Exception Location: /usr/lib/python2.5/site-packages/django/template/
debug.py in render_node, line 81
Python Executable:  /usr/bin/python
Python Version: 2.5.2
Python Path:['/home/guy/DjangoApps/scinet', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/
python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/
python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/
lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-
packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/
python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0']
Server time:Sat, 11 Apr 2009 13:54:58 -0500
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---