#10328: get_script_path and request.path_info undocumented?
---------------------------+------------------------------------------------
 Reporter:  leovitch       |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.0       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 As near as I can tell by reading the code, the new django.path support for
 mod_python in 1.0 has a couple implications for code in cases where the
 application needs to do URL manipulations itself (I found this while
 testing django-cms).  While the normal urlresolver takes care of anything
 done through reverse() or the url template tag, code that does its own
 manipulations on URLs need to:

  * Call get_script_prefix() to get the script prefix portion to use when
 constructing an URL from scratch
  * Use request.path_info rather than request.path when parsing an URL

 Unfortunately, both of those seem to be undocumented (at least, I can't
 find the documentation).  Shouldn't they be described?

 Purely in the spirit of being helpful rather than just complaining, below
 is my understanding of what the documentation would be -- but I didn't
 write the original code, so please disregard/correct/wordsmith this as
 appropriate.

 Leo

 -------------

 get_script_prefix() would be described under URL Dispatcher > Utility
 Methods as follows.

 Normally, you should always use reverse() or permalink() to define URLs
 within your application.  However, if your application constructs part of
 the URL hierarchy itself you may occasionally need to generate URLs.  In
 that case, you need to be able to find the base URL of the Django project
 within its web server (normally, the urlresolver takes care of this for
 you).  In that case, you can call get_script_prefix(), which will return
 the script prefix portion of the URL for your Django project.  If your
 Django project is at the root of its webserver, this is always '/', but it
 can be changed for instance by using the django.root option in the
 modpython handler under Apache.

 The path_info attribute of a request object would be documented under
 Request and Response Objects > HTTPRequest objects > Attributes as
 follows:

 HttpRequest.path_info

 Under some web server configurations, the path to the page after the host
 name is split up into a script prefix portion and a path info portion
 (this happens, for example, when using the modpython handler from Apache).
 The path_info attribute always contains the path_info portion of the path,
 no matter what web server is being used.  Using this instead of path can
 make your code much easier to move between web servers, since you won't
 need to care what your URL within the overall web server is.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10328>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to