Django

Code

Changeset 7110

Show
Ignore:
Timestamp:
02/13/08 22:54:03 (8 months ago)
Author:
mtredinnick
Message:

Updated the documentation for patterns() to note Python's 255 argument limit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/url_dispatch.txt

    r6743 r7110  
    191191`Passing extra options to view functions`_ below.) 
    192192 
     193.. note:: 
     194    Since `patterns()` is a function call, it accepts a maximum of 255 
     195    arguments (URL patterns, in this case). This is a limit for all Python 
     196    function calls. This will rarely be  problem in practice, since you'll 
     197    typically structure your URL patterns modularly by using `include()` 
     198    sections. However, on the off-chance you do hit the 255-argument limit, 
     199    realise that `patterns()` returns a Python list, so you can split up the 
     200    construction of the list. 
     201 
     202    :: 
     203 
     204        urlpatterns = patterns('', 
     205            ... 
     206            ) 
     207        urlpatterns += patterns('', 
     208            ... 
     209            ) 
     210 
     211    Python lists have unlimited size, so there's no limit to how many URL 
     212    patterns you can construct; merely that you may only create 254 at a time 
     213    (the 255-th argument is the initial prefix argument). 
     214 
    193215url 
    194216---