Filter ALL requests before dispatching via URLs.py?

2009-03-10 Thread Joshua K
Hello, Is there a way to filter all requests before URLS.py dispatches the request? I am developing a Pinax application. I have some custom menu tabs across the top, and I limit the visibility of those tabs depending on flags present in the user's account. I do this by enabling custom f

Re: Django will not match r^sip/conf string in urls.py on Apache2 / modpython

2009-03-04 Thread Dan
Looks like I had a sip directory under my templates so was confusing Apache I guess. Anyway, fixed now so thanks. Renamed it as noted above. On Mar 4, 9:10 am, Rajesh Dhawan wrote: > Rajesh D wrote: > > On Mar 4, 9:58 am, Dan wrote: > > > Url pattern below r^sip/conf and sip/createfile work for

Re: Django will not match r^sip/conf string in urls.py on Apache2 / modpython

2009-03-04 Thread Rajesh Dhawan
Rajesh D wrote: > On Mar 4, 9:58 am, Dan wrote: > > Url pattern below r^sip/conf and sip/createfile work for development > > server but Apache comes up with a 404 error. Note that the error is > > shown as Apache error not Django parsing error. So, is it Apache not > > using the Python interpre

Re: Django will not match r^sip/conf string in urls.py on Apache2 / modpython

2009-03-04 Thread Rajesh D
On Mar 4, 9:58 am, Dan wrote: > Url pattern below r^sip/conf and sip/createfile work for development > server but Apache comes up with a 404 error. Note that the error is > shown as Apache error not Django parsing error. So, is it Apache not > using the Python interpreter or something with Djan

Django will not match r^sip/conf string in urls.py on Apache2 / modpython

2009-03-04 Thread Dan
Url pattern below r^sip/conf and sip/createfile work for development server but Apache comes up with a 404 error. Note that the error is shown as Apache error not Django parsing error. So, is it Apache not using the Python interpreter or something with Django? Note that changing the name to statio

Re: http links without using URLs.py

2009-01-27 Thread May
Thanks! Ana On Jan 27, 9:51 am, Adam Stein wrote: > Eggs seems to be something related to python packages, not sure exactly > what they are used for.  I needed the PYTHON_EGG_CACHE because my web > server could not write to the default egg cache directory and so I had > it use a temp place. > >

Re: http links without using URLs.py

2009-01-27 Thread Adam Stein
Eggs seems to be something related to python packages, not sure exactly what they are used for. I needed the PYTHON_EGG_CACHE because my web server could not write to the default egg cache directory and so I had it use a temp place. Perhaps somebody else can better explain eggs. On Tue, 2009-01

Re: http links without using URLs.py

2009-01-27 Thread May
Hello Adam, Thanks! I have already set up several sections for the django site, so I must not have the syntax quite right for apache to ignore the static links. I will work on it. One last question? What are eggs? SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs Thanks, Ana On Ja

Re: http links without using URLs.py

2009-01-27 Thread Brian Neal
On Jan 27, 11:06 am, May wrote: > Hello, > > The tutorial suggests not serving the static pages with this method on > a permanent basis.  Are you using this method for your production > server?  I'm using windows/apache/modpython and I've tried using the > IP address and still run into django url

Re: http links without using URLs.py

2009-01-27 Thread Marco Buttu
On Tue, 2009-01-27 at 08:42 -0800, May wrote: > I'm converting PHP pages to Django. I'm using base.html for my > formatting. I've included the left-side bar in the base.html, which > includes links that do not require using a database, such as the > "contact us" page. Since I'm using localhos

Re: http links without using URLs.py

2009-01-27 Thread Adam Stein
I ONLY use it for development with the Django server. I only set up to serve static pages when DEBUG = True (as they show toward the bottom of the page). No need to change links on the production server (apache + mod_python) because the URLs are a different location than what I have set up for m

Re: http links without using URLs.py

2009-01-27 Thread May
Hello, The tutorial suggests not serving the static pages with this method on a permanent basis. Are you using this method for your production server? I'm using windows/apache/modpython and I've tried using the IP address and still run into django url requests. Do you know of a way to get apac

Re: http links without using URLs.py

2009-01-27 Thread Adam Stein
Check out: http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs I have Django serve static files during development so that all my links that don't need to go thru Django work. On Tue, 2009-01-27 at 08:42 -0800, May wrote: > Hello, > > I'm converting PHP pages to Django. I'm

http links without using URLs.py

2009-01-27 Thread May
Hello, I'm converting PHP pages to Django. I'm using base.html for my formatting. I've included the left-side bar in the base.html, which includes links that do not require using a database, such as the "contact us" page. Since I'm using localhost for testing my link looks something like this

Re: "submit" and urls.py fail after moving site from runserver to Apache

2009-01-09 Thread rabbi
quot; is different, and this obviously causes the > > pattern matching in urls.py to fail > > That's not correct. See below. > > > > > > > Here is the html + template script that causes the problem > > >    {% if error_message %}{{ error_message

Re: "submit" and urls.py fail after moving site from runserver to Apache

2009-01-07 Thread Malcolm Tredinnick
is different, and this obviously causes the > pattern matching in urls.py to fail That's not correct. See below. > > Here is the html + template script that causes the problem > > {% if error_message %}{{ error_message }}{% > endif %} > >

"submit" and urls.py fail after moving site from runserver to Apache

2009-01-07 Thread rabbi
t" is different, and this obviously causes the pattern matching in urls.py to fail Here is the html + template script that causes the problem {% if error_message %}{{ error_message }}{% endif %} {% for entry in entry_list %} {{ ent

dynamic load urls.py problem

2008-12-27 Thread strelnikovdmitrij
hi guys...me again...but now I've done a little step forward, when I load urls file through request.urlconf it does not append end slash to any url..:( and urls without trailing slash try map through base urls.py file (ROOT_URLCONF). in new url.py file I specify urlpatterns = pattern() not +

Re: urls.py password reset view.

2008-12-20 Thread kev
it's rather handy: > > http://www.rkblog.rk.edu.pl/w/p/password-reset-django-10/ > > -Jeff > > On Dec 20, 12:01 pm, kev wrote: > > > Hello, > > I have the following entry in urls.py file: > > >         (r'^forgotpassword/$', passwor

Re: urls.py password reset view.

2008-12-20 Thread Jeff FW
ff On Dec 20, 12:01 pm, kev wrote: > Hello, > I have the following entry in urls.py file: > >         (r'^forgotpassword/$', password_reset, { >                 'template_name': 'users/forgotpassword.html', >                

urls.py password reset view.

2008-12-20 Thread kev
Hello, I have the following entry in urls.py file: (r'^forgotpassword/$', password_reset, { 'template_name': 'users/forgotpassword.html', 'email_template_name': 'users/forgotpassword_template.html'

Re: passing data with urls.py

2008-10-14 Thread Tim Chase
>>http://docs.python.org/lib/re-syntax.html >> >> There are several good books and websites that will teach you the >> basics of regexps, and a quick search will bring back a number of >> results. > > Thank alot thats the best response I have had. Glad to help...though in a way, it's as much

Re: passing data with urls.py

2008-10-13 Thread bruno desthuilliers
On 13 oct, 23:14, KillaBee <[EMAIL PROTECTED]> wrote: (snip) > > I creted the url strucure like I want it ,and the user was add to the > url. Nope. The user *id*. > How can I just display it on a page. I was thinking that I was > not login in cerrectlly, but only on the login can I use the aut

Re: passing data with urls.py

2008-10-13 Thread KillaBee
On Oct 13, 2:39 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 13 oct, 20:13, KillaBee <[EMAIL PROTECTED]> > wrote: > > > > > I am want in to pass the user and a date, using the url.  Like the > > polls urls > > (r'^(?P\d+)/$', 'intranet.timesheets.views.detail'), > > > I tried these, b

Re: passing data with urls.py

2008-10-13 Thread bruno desthuilliers
On 13 oct, 20:13, KillaBee <[EMAIL PROTECTED]> wrote: > I am want in to pass the user and a date, using the url. Like the > polls urls > (r'^(?P\d+)/$', 'intranet.timesheets.views.detail'), > > I tried these, but I am missing a piece: > urlpatterns = patterns('', > (r'^timesheet/(?P)/$', > 'i

Re: passing data with urls.py

2008-10-13 Thread KillaBee
On Oct 13, 1:53 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > I tried these, but I am missing a piece: > > urlpatterns = patterns('', > >     (r'^timesheet/(?P)/$', > > 'intranet.timesheets.views.times'), > >     (r'^timesheet/(?P\d{20})/$', > > 'intranet.timesheets.views.times'), > >     (r'^tim

Re: passing data with urls.py

2008-10-13 Thread Tim Chase
> I tried these, but I am missing a piece: > urlpatterns = patterns('', > (r'^timesheet/(?P)/$', > 'intranet.timesheets.views.times'), > (r'^timesheet/(?P\d{20})/$', > 'intranet.timesheets.views.times'), > (r'^timesheet/(?P\d{20})/(?P\d{10})/$', > 'intranet.timesheets.views.times'), >

passing data with urls.py

2008-10-13 Thread KillaBee
I am want in to pass the user and a date, using the url. Like the polls urls (r'^(?P\d+)/$', 'intranet.timesheets.views.detail'), I tried these, but I am missing a piece: urlpatterns = patterns('', (r'^timesheet/(?P)/$', 'intranet.timesheets.views.times'), (r'^timesheet/(?P\d{20})/$', 'i

Re: django.views.generic.simple.direct_to_template doesn't support text/xml in urls.py?

2008-09-01 Thread ristretto.rb
I'm using 1.0 alpha, and had the same problem. Adding 'mimetype':'text/xml' as noted worked perfectly. thanks for the post!! On Aug 9, 8:25 pm, Valery <[EMAIL PROTECTED]> wrote: > Hi Julien, > > thank you for the answer. > > I've just tested your code, the effect is the same. Namely, > opensear

Re: newbie urls.py question

2008-08-22 Thread ViX
; > I don't see anything like > > from pinax import * > > > But it is doing: > > (r'^about/', include('about.urls')), > > instead of : > > (r'^about/', include('pinax.about.urls')), > > > Best, > >

Re: newbie urls.py question

2008-08-21 Thread jason
e/trunk/pinax/url... > > I don't see anything like > from pinax import * > > But it is doing: > (r'^about/', include('about.urls')), > instead of : > (r'^about/', include('pinax.about.urls')), > > Best, > V > > On Aug

Re: newbie urls.py question

2008-08-21 Thread ViX
That seems not the case, eg. http://code.google.com/p/django-hotclub/source/browse/trunk/pinax/urls.py I don't see anything like from pinax import * But it is doing: (r'^about/', include('about.urls')), instead of : (r'^about/', include('pinax.abo

Re: newbie urls.py question

2008-08-21 Thread Jonathan Nelson
Look at the import statements on the different urls.py files. This: from myproject.myapp import myview urlpatterns = patterns('', (r'^somepattern/', myview)) Does the same thing as this: urlpatterns = patterns('', (r'^somepattern/', myproje

newbie urls.py question

2008-08-21 Thread ViX
I saw some django projects have the site urls.py urlpatterns = patterns('', (r'^app/', include('apps.urls')), ) instead of the regular one: urlpatterns = patterns('', (r'^app/', include('mysite.apps.urls')), ) What ne

/contrib/admin/urls.py doesn't exist

2008-07-20 Thread Filipe Sabella
latest version from the SVN. I searched the site-packages/django/contrib/admin, and there's no urls.py file. I downloaded the latest stable version (.96), and there is an urls.py file on the same directory, but when I tried to place it on the directory of the current Django version, other except

Re: /contrib/admin/urls.py doesn't exist

2008-07-20 Thread Horst Gutmann
lhost:8000/admin, I get this > exception: > ImproperlyConfigured: Error while importing URLconf > 'django.contrib.admin.urls': No module named urls > > I'm using the latest version from the SVN. > I searched the site-packages/django/contrib/admin, and there's

Re: Failure to compile urls.py on startup

2008-07-05 Thread Malcolm Tredinnick
On Sat, 2008-07-05 at 04:35 -0700, zobbo wrote: [...] > Comments welcomed. I'm not likely to make the same mistake again but > interested to know if there's a solution for this. Besides the obvious > "Don't ignore error messages" :) If there's not already a ticket open for this in Trac (do a bit

Failure to compile urls.py on startup

2008-07-05 Thread zobbo
I've been working through "Practical Django Projects" by James Bennet. I came across some unexpected behaviour which I wanted to share regarding handling errors on startup within the urls configuration. In the weblog application he talks you through, he discusses splitting

Re: Relative views in urls.py

2008-05-30 Thread Gregor Müllegger
Your last example is near the typical solution. You could pass as second element of the "url-tuples" a callable object e.g. a view. from django.conf.urls.defaults import * import views urlpatterns = patterns('', (r'^(?P[a-z0-9_-]+)/$', views.view_city), (r'^(?P[a-z0-9_-]+)/category/(?P[a

Relative views in urls.py

2008-05-30 Thread David Cramer
I've come across the need lately, for my applications to be completely standalone, and this has presented itself a few problems: - I need urls.py to be dynamically editable (at least at runtime). I think I can deal with this one, just haven't gotten to it. - More importantly, I need

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Matt Hoskins
On May 28, 2:06 pm, [EMAIL PROTECTED] wrote: > Couldn't you also use something along the lines of > ^price[s]/ > > Though I may have the syntax wrong. Just to correct your syntax the regular expression for making the last letter in that example optional would be: ^prices?/ Matt --~--~

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry Schork
ing. Taking the simpliest, I > > > > would like to implement this regexp: > > > > ^pric(e|es)/ > > > > into urls.py, but the () are overlapping with the text capture, as it > > > > seems. > > > > > If you want to use parenthese

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread titaniumlou
t; It's simply an OR done into the matching. Taking the simpliest, I > > > would like to implement this regexp: > > > ^pric(e|es)/ > > > into urls.py, but the () are overlapping with the text capture, as it > > > seems. > > > If you want to use parent

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry Schork
> > It's simply an OR done into the matching. Taking the simpliest, I > > would like to implement this regexp: > > ^pric(e|es)/ > > into urls.py, but the () are overlapping with the text capture, as it > > seems. > > If you want to use parentheses that d

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Matt Hoskins
ould like to implement this regexp: > ^pric(e|es)/ > into urls.py, but the () are overlapping with the text capture, as it > seems. If you want to use parentheses that don't capture use "?:" to flag it as non-grouping. So instead try: ^pric(?:e|es)/ Matt --~--~-~--~--

urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry
Hello django users, I'm new to django, and I was looking to implement a very simple url scheme that I used for a PHP site. It's simply an OR done into the matching. Taking the simpliest, I would like to implement this regexp: ^pric(e|es)/ into urls.py, but the () are overlapping wit

Re: Question about urls.py

2008-04-22 Thread Alex Morega
On Apr 22, 2008, at 16:34 , jmDesktop wrote: > But what I don't understand is the comment on GET. I thought that was > what I was doing. Or am I doing the same thing only wrong? Are you > saying that I should use a querystring in the url like myurl/? > email=theemail&anothervar=something... i

Re: Question about urls.py

2008-04-22 Thread jmDesktop
I ended up with this (from both of you, thanks): urls.py: (r'^contact/thanks/(?P.*)/$','mysite.books.views.thanks'), and in my views.py: def thanks(request, sender): return render_to_response('books/thanks.html',{'user': sender}) thanks.ht

Re: Question about urls.py

2008-04-21 Thread Kenneth Gonsalves
On 22-Apr-08, at 4:00 AM, jmDesktop wrote: > (r'^contact/thanks/(.)/$','mysite.books.views.thanks' (r'^contact/thanks/(?P.)/$','mysite.books.views.thanks'), will direct to the thanks function which you call as: def thanks(request,sender) and this thanks function loads the thanks template with

Re: Question about urls.py

2008-04-21 Thread Alex Morega
On Apr 22, 2008, at 01:30 , jmDesktop wrote: > > What I have in my urls.py file is: > > (r'^contact/thanks/(.)/$','mysite.books.views.thanks'), try this: (r'^contact/thanks/(?P.*)/$','mysite.books.views.thanks'), The idea is to captur

Question about urls.py

2008-04-21 Thread jmDesktop
Hi, I am trying to understand how URLconf works and why I am failing at a simple task. I have this in one my .py files (larger snippet is an email responder from djangobook chap7): return HttpResponseRedirect('/contact/thanks/%s' % sender ) What I have in my urls.py file is: (

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
probably not render very well. All the > same, any content that's hard-coded directly in the template, rather > than being pulled from the context, is fair game for an attacker to > access. > > Consider something like this instead: > > #in urls.py > def easy_

Re: Need help DRYing up urls.py

2008-04-18 Thread Marty Alchin
an attacker to access. Consider something like this instead: #in urls.py def easy_template(name): return (r'^%s/$' % name, direct_to_template, {'template': '%s.html' % name}) urlpatterns = patterns('', (r'^$', direct_to_temp

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Gotcha. Very, very cool. Here's what I did. Please tell me if there's a better way: #in views.py def return_template(request, template): return direct_to_template(request, (template + '.html')) #in urls.py from django.conf.urls.defaults import * from rdk.pages.views im

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
to say that I have imported the view into urls.py > > from rdk.pages.views import return_template > > On Apr 18, 2:39 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > I understand the concept of that, but I'm having an issue with > > importing the vie

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Sorry, forgot to say that I have imported the view into urls.py from rdk.pages.views import return_template On Apr 18, 2:39 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > I understand the concept of that, but I'm having an issue with > importing the view function into my urls.

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
I understand the concept of that, but I'm having an issue with importing the view function into my urls.py. Here's what I have so far: #in views.py from django.views.generic.simple import direct_to_template def return_template(template): return direct_to_template(template % &#x

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
Yes, instead of having it use a generic directly in the urlconf, you would have it go to the view, the view would do what you need(specifically doing that simple substitution), and then have it return django.views.generic.simple.direct_to_template, remember views are just functions, if you need an

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Hi Alex, Thanks for the advice. Still being new to Django, where would such a wrapper function need to exist? In the views.py? models.py? I'm guessing it would need to be something along the lines of: def replace_template_var(template): return template % '.html' ? Please advise, Brandon O

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
Direct_to_template does not substitute the template var in to the template param, you will need to write a simple wrapper to do something like this. On Apr 18, 12:35 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Ah. I see now. It's matching the first part of the URL, but it doesn't > seem to wa

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Ah. I see now. It's matching the first part of the URL, but it doesn't seem to want to substitute the named parameter as (template) as such: (r'(?P[-\w]+)/$', direct_to_template, {'template' : '% (template)s.html'}), Thanks, Brandon On Apr 18, 11:25 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote

Re: Need help DRYing up urls.py

2008-04-18 Thread Marty Alchin
On Fri, Apr 18, 2008 at 12:17 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > (r'?P[-\w]+/$', direct_to_template, {'template' : '% > (template)s.html'}), > > ...and received an error saying: > Error while importing URLconf 'rdk.pages.urls': nothing to repeat You're missing parentheses around

Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Hi everyone, Coming from Rails, I've been naming my templates according to their corresponding URLs. But, since Django's routing is RegEx based, I'm sure there's a better way to do this: urlpatterns = patterns('', (r'^$', direct_to_template, {'template':'home.html'}), (r'^contact/$', dir

Re: Accessing Session from urls.py

2008-04-13 Thread [EMAIL PROTECTED]
n. That is, I want to change the url->view mapping based on > the session variables. Problem is, I can't seem to figure out how to > access the session from urls.py. I understand that outside views I > can load up a session object by importing > django.contrib.sessions.models.Sessi

Accessing Session from urls.py

2008-04-13 Thread Cole Tuininga
Hey folks - I'm looking to make url "routing" choices based on some values from the session. That is, I want to change the url->view mapping based on the session variables. Problem is, I can't seem to figure out how to access the session from urls.py. I understand t

Re: Trouble with pattern in urls.py

2008-01-23 Thread almostvindiesel
; > > almostvindiesel wrote: > > Hi all, > > > I'm new to regex/django/python, and I'm having trouble getting urls.py > > to pass a request to a view. Specifically, when I hit: > > >http://django.mysite.com/chef/home/param1/param2/ > > > I

Re: Trouble with pattern in urls.py

2008-01-23 Thread Ned Batchelder
gex/django/python, and I'm having trouble getting urls.py > to pass a request to a view. Specifically, when I hit: > > http://django.mysite.com/chef/home/param1/param2/ > > I'd expect the 3rd from the last pattern to match: > > ## my urls.py f

Trouble with pattern in urls.py

2008-01-23 Thread almostvindiesel
Hi all, I'm new to regex/django/python, and I'm having trouble getting urls.py to pass a request to a view. Specifically, when I hit: http://django.mysite.com/chef/home/param1/param2/ I'd expect the 3rd from the last pattern to match: ######

Re: How to get the urls defined in urls.py

2007-12-18 Thread Rajesh Dhawan
On Dec 18, 9:10 am, shabda <[EMAIL PROTECTED]> wrote: > I have my urls.py defined as > urlpatterns = patterns('app.views', > (r'^foo/$', 'foo'), > (r'^bar/$', 'bar'),) > > Now from a template i need to ac

Re: How to get the urls defined in urls.py

2007-12-18 Thread James Bennett
On Dec 18, 2007 8:10 AM, shabda <[EMAIL PROTECTED]> wrote: > Now from a template i need to access these urls. So inside the > template we can refer them as /foo/, /bar/. However later when I > change the urls.py, these urls defined in urls.py would break. What > would be a go

How to get the urls defined in urls.py

2007-12-18 Thread shabda
I have my urls.py defined as urlpatterns = patterns('app.views', (r'^foo/$', 'foo'), (r'^bar/$', 'bar'),) Now from a template i need to access these urls. So inside the template we can refer them as /foo/, /bar/. However later when I

Generating web-service API docs from urls.py

2007-11-27 Thread raminf
o the consumers of your web-service API. It seems like scanning urls.py and tracking down the chain of 'include' settings is what would be needed. I'm guessing there isn't anything out there, but I figured I'd ask first in case someone had alread

Re: Help setting up urls.py to handle predominantly static site

2007-10-13 Thread SmileyChris
On Oct 13, 4:09 pm, Jason <[EMAIL PROTECTED]> wrote: > Hey everyone-- > > I've got a predominantly static site that I need to serve through > Django, at least until I can convert more of it over properly. Yes, I > know this is discouraged, but it's the only way I'm going to be able > to move fo

Help setting up urls.py to handle predominantly static site

2007-10-12 Thread Jason
index.html" % (path,))), * (r'^(?P.*)$', direct_to_template), ...but I've had no luck w/either of those. Anyone had any experience w/this? I'd really like to establish a catch-all-- very specific Django-pages defined first in my urls.py, then everything else passes

Re: Using decoupled urls.py and generic views

2007-09-14 Thread Nathaniel Whiteinge
Whoops, mind the typo. Should be:: urlpatterns = patterns("xgm.AbbrDB.views", (r"^$", "search"), ) urlpatterns += patterns("django.views.generic.list_detail", (r'^list/$', 'object_list', info_dict), ) --~--~-~--~~~---~--~~ You rece

Re: Using decoupled urls.py and generic views

2007-09-14 Thread Nathaniel Whiteinge
If you're only doing one or two, use callables [1]_ which will ignore your view prefix:: from django.conf.urls.defaults import * from models import Abbreviation import django.views.generic.list_detail.object_list as object_list info_dict = { "queryset": Abbreviation.objects.all()

Using decoupled urls.py and generic views

2007-09-14 Thread Florian Lindner
Hello, part 3 of the tutorial introduced how to decouple URL configuration into the app dir. At part 4 [1] generic views are introduced and the decoupled URL configuration: from django.conf.urls.defaults import * urlpatterns = patterns('mysite.polls.views', (r'^$', 'index'), (r'^(?P\d+

size of urls.py

2007-09-14 Thread Dushyant Sharma
is there any performance bottleneck when the size of urls.py goes large. if yes how to overcome that. also if we use same url for a particular group, based on some hidden action variable in htmls, would it improve performance. like i am using if request.method == 'POST':

Re: Tip:decorator and urls.py

2007-08-21 Thread !张沈鹏(电子科大 08年毕业)
I think do like below maybe more simple from django.shortcuts import render_to_response from django.template.context import RequestContext def template_name(func): def _template_name(request,template_name,*args,**keys): result=func(request,*args,**keys) if type(result)!=dict

Re: Empty urls.py file and {% url %} tags

2007-06-25 Thread Malcolm Tredinnick
On Mon, 2007-06-25 at 21:43 +1000, Malcolm Tredinnick wrote: > On Mon, 2007-06-25 at 10:06 +, Ryan Kanno wrote: > > I know this isn't big (and maybe it's by design), but this didn't > > happen prior to I believe -r 5516. If you have a empty urls.py > >

Re: Empty urls.py file and {% url %} tags

2007-06-25 Thread Malcolm Tredinnick
On Mon, 2007-06-25 at 10:06 +, Ryan Kanno wrote: > I know this isn't big (and maybe it's by design), but this didn't > happen prior to I believe -r 5516. If you have a empty urls.py > include file in any app within the project, it causes the {% url %} > tag to no

Empty urls.py file and {% url %} tags

2007-06-25 Thread Ryan Kanno
I know this isn't big (and maybe it's by design), but this didn't happen prior to I believe -r 5516. If you have a empty urls.py include file in any app within the project, it causes the {% url %} tag to not resolve for any app, even an unrelated app view. The exception return

Re: urls.py regex problem

2007-03-30 Thread Malcolm Tredinnick
On Sat, 2007-03-31 at 01:44 +, benrawk wrote: > Hello, > > When I am running the simple current_datetime example from the django > book, and then edit my urls.py to look like the one in the book, the > page doesn't server. > > Book urls.py: > from dja

urls.py regex problem

2007-03-30 Thread benrawk
Hello, When I am running the simple current_datetime example from the django book, and then edit my urls.py to look like the one in the book, the page doesn't server. Book urls.py: from django.conf.urls.defaults import * f from mysite.views import current_datetime urlpat

Re: Retrieve `request` object in `urls.py`?

2007-03-25 Thread Alex Dong
Thanks Malcolm, sounds like `getattr` might be a good solution. I'll take a look into that and post back. -- Alex On Mar 26, 9:58 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-03-25 at 18:22 -0700, Alex Dong wrote: > > Hi Malcolm, > > > Thanks for the quick reply. > > > What I'

Re: Retrieve `request` object in `urls.py`?

2007-03-25 Thread Malcolm Tredinnick
On Sun, 2007-03-25 at 18:22 -0700, Alex Dong wrote: > Hi Malcolm, > > Thanks for the quick reply. > > What I'm wondering about is that I've seen the pattern repeat itself > quite a few times where I have to write a little wrapper doing nothing > more than retrieving something from the `request`

Re: Retrieve `request` object in `urls.py`?

2007-03-25 Thread Alex Dong
5 at 17:55 -0700, Alex Dong wrote: > > Hi folks, > > I'd like to refactor the following code into one line in urls.py: > > > Now: > > in `urls.py`: > > +(r'^watchlist/$', > > 'package.watchlist.views.rredirect_to_personalized_watc

Re: Retrieve `request` object in `urls.py`?

2007-03-25 Thread Malcolm Tredinnick
Hi Alex, On Sun, 2007-03-25 at 17:55 -0700, Alex Dong wrote: > Hi folks, > I'd like to refactor the following code into one line in urls.py: > > Now: > in `urls.py`: > +(r'^watchlist/$', > 'package.watchlist.views.rredirect_to_personalized_watch_

Retrieve `request` object in `urls.py`?

2007-03-25 Thread Alex Dong
Hi folks, I'd like to refactor the following code into one line in urls.py: Now: in `urls.py`: +(r'^watchlist/$', 'package.watchlist.views.rredirect_to_personalized_watch_list'), +(r'^users/(?P.*)/watchlist/$', 'package.watchlist.views.watchlist&#

Re: Using re.VERBOSE with urls.py?

2007-02-08 Thread Jeremy Dunck
On 2/8/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > Any hints? Thanks, > > -tkc No, but I need something like that and just broke it down in to vars, concatenating them later: cat_re = r"(in/(?P([^/]+/)*))?" ... (r'^(?P\d{4})/(?P\w{3})/%s$' % cat_re, ...), --~--~-~--~~

Using re.VERBOSE with urls.py?

2007-02-08 Thread Tim Chase
This may have a simple answer that I've overlooked. Is there a way to specify that the regexps used for mapping URLs in urls.py are in re.VERBOSE format rather than all in one line? I have several pieces that are easily recognizable when specified as VERBOSE, but when given in one lin

Re: Evaluation of urls.py in mod_python

2007-01-19 Thread Jyrki Pulliainen
On 1/11/07, Waylan Limberg <[EMAIL PROTECTED]> wrote: > > If my understanding is correct, when you use this method: > > > choices = { > > 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(), > > closing_date__gte=datetime.now()) > > } > > The value of datetime.now() is evaluated a

Re: Evaluation of urls.py in mod_python

2007-01-11 Thread Waylan Limberg
If my understanding is correct, when you use this method: > choices = { > 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(), > closing_date__gte=datetime.now()) > } The value of datetime.now() is evaluated at compilation time when apache/mod_python is started (or at least when

Evaluation of urls.py in mod_python

2007-01-11 Thread Jyrki Pulliainen
Hi, after running in some rather strange problems I got curious about the way Django and/or mod_python evaluates urls.py. Is there a difference if I use following code: now = datetime.now() choices = { 'queryset': Poll.objects.filter(opening_date__lte=now, closing_date__gte=now

Tip:decorator and urls.py

2006-12-28 Thread limodou
'', (r'^$', func), ) ->8-- So this a great thing! We can make many tricks on it. And I want to introduce how to use decorator on it. Very simple! Say you put check_userid in a module n

Re: Tip:decorator and urls.py

2006-12-28 Thread limodou
-8<-- @template('template.html') def list(request): if success: #return HttpResponseRedirect('url') raise HttpRedirectException else: return errorinfo -

Re: urls.py error

2006-09-25 Thread brad
Thanks Shaun Li. I just figured that out, but thank you because I very well could have still been stumped until you posted. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: urls.py error

2006-09-25 Thread brad
Opps. I posted before I treid all that I could try. I found my error thanks to you help Don Arbow and everybody's help on my last post. Thanks you all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: urls.py error

2006-09-25 Thread Shaun Li
Just add ',' after ')' when only one note that tuple needed:(r'^select/$', 'mysite.polls.views.select'),-- Shaun Li --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: urls.py error

2006-09-25 Thread brad
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^mysite/', include('mysite.apps.foo.urls.foo')), (r'^polls/$', 'mysite.polls.views.select'), (r'^polls/(?P\d+)/$', 'mysite.polls.views.detail'), (r'^polls/(?P\d+)/results/$', 'mysite.polls.views

<    1   2   3   4   5   >