Changeset 4503
- Timestamp:
- 02/13/07 10:15:10 (2 years ago)
- Files:
-
- django/branches/newforms-admin/AUTHORS (modified) (9 diffs)
- django/branches/newforms-admin/django/conf/__init__.py (modified) (2 diffs)
- django/branches/newforms-admin/django/conf/project_template/settings.py (modified) (1 diff)
- django/branches/newforms-admin/django/contrib/auth/forms.py (modified) (1 diff)
- django/branches/newforms-admin/django/contrib/syndication/feeds.py (modified) (2 diffs)
- django/branches/newforms-admin/django/db/models/__init__.py (modified) (1 diff)
- django/branches/newforms-admin/django/db/models/query.py (modified) (8 diffs)
- django/branches/newforms-admin/django/db/models/related.py (modified) (1 diff)
- django/branches/newforms-admin/django/http/__init__.py (modified) (1 diff)
- django/branches/newforms-admin/django/newforms/fields.py (modified) (1 diff)
- django/branches/newforms-admin/django/template/context.py (modified) (1 diff)
- django/branches/newforms-admin/django/template/defaultfilters.py (modified) (3 diffs)
- django/branches/newforms-admin/django/template/defaulttags.py (modified) (2 diffs)
- django/branches/newforms-admin/django/template/__init__.py (modified) (2 diffs)
- django/branches/newforms-admin/django/template/loader_tags.py (modified) (1 diff)
- django/branches/newforms-admin/django/test/client.py (modified) (5 diffs)
- django/branches/newforms-admin/django/utils/feedgenerator.py (modified) (7 diffs)
- django/branches/newforms-admin/django/utils/text.py (modified) (1 diff)
- django/branches/newforms-admin/docs/contributing.txt (modified) (2 diffs)
- django/branches/newforms-admin/docs/django-admin.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/fastcgi.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/forms.txt (modified) (4 diffs)
- django/branches/newforms-admin/docs/outputting_pdf.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/settings.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/syndication_feeds.txt (modified) (3 diffs)
- django/branches/newforms-admin/docs/templates_python.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/templates.txt (modified) (3 diffs)
- django/branches/newforms-admin/docs/testing.txt (modified) (2 diffs)
- django/branches/newforms-admin/MANIFEST.in (modified) (1 diff)
- django/branches/newforms-admin/scripts (copied) (copied from django/trunk/scripts)
- django/branches/newforms-admin/scripts/rpm-install.sh (copied) (copied from django/trunk/scripts/rpm-install.sh)
- django/branches/newforms-admin/setup.cfg (modified) (1 diff)
- django/branches/newforms-admin/tests/modeltests/lookup/models.py (modified) (3 diffs)
- django/branches/newforms-admin/tests/modeltests/test_client/models.py (modified) (1 diff)
- django/branches/newforms-admin/tests/modeltests/test_client/urls.py (modified) (1 diff)
- django/branches/newforms-admin/tests/modeltests/test_client/views.py (modified) (1 diff)
- django/branches/newforms-admin/tests/regressiontests/defaultfilters/tests.py (modified) (2 diffs)
- django/branches/newforms-admin/tests/regressiontests/forms/tests.py (modified) (3 diffs)
- django/branches/newforms-admin/tests/regressiontests/templates/tests.py (modified) (2 diffs)
- django/branches/newforms-admin/tests/regressiontests/templates/urls.py (copied) (copied from django/trunk/tests/regressiontests/templates/urls.py)
- django/branches/newforms-admin/tests/regressiontests/templates/views.py (copied) (copied from django/trunk/tests/regressiontests/templates/views.py)
- django/branches/newforms-admin/tests/runtests.py (modified) (6 diffs)
- django/branches/newforms-admin/tests/urls.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin/AUTHORS
r4274 r4503 1 1 Django was originally created in late 2003 at World Online, the Web division 2 2 of the Lawrence Journal-World newspaper in Lawrence, Kansas. 3 4 3 5 4 The PRIMARY AUTHORS are (and/or have been): … … 46 45 akaihola 47 46 Andreas 47 andy@jadedplanet.net 48 48 ant9000@netwise.it 49 49 David Ascher <http://ascher.ca/> … … 54 54 Esdras Beleza <linux@esdrasbeleza.com> 55 55 James Bennett 56 Ben <afternoon@uk2.net> 56 57 Paul Bissex <http://e-scribe.com/> 57 58 Simon Blanchard 58 59 Andrew Brehaut <http://brehaut.net/blog> 59 andy@jadedplanet.net 60 brut.alll@gmail.com 61 Jonathan Buchanan <jonathan.buchanan@gmail.com> 60 62 Antonio Cavedoni <http://cavedoni.com/> 61 63 C8E … … 67 69 Matt Croydon <http://www.postneo.com/> 68 70 dackze+django@gmail.com 71 Dirk Datzert <dummy@habmalnefrage.de> 69 72 Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/> 73 dave@thebarproject.com 70 74 Jason Davies (Esaj) <http://www.jasondavies.com/> 71 75 Alex Dedul … … 73 77 dne@mayonnaise.net 74 78 Maximillian Dornseif <md@hudora.de> 75 dummy@habmalnefrage.de76 79 Jeremy Dunck <http://dunck.us/> 77 80 Andy Dustman <farcepest@gmail.com> 78 81 Clint Ecker 79 82 Enrico <rico.bl@gmail.com> 83 Marc Fargas <telenieko@telenieko.com> 80 84 favo@exoweb.net 81 85 Eric Floehr <eric@intellovations.com> … … 85 89 Simon Greenhill <dev@simon.net.nz> 86 90 Espen Grindhaug <http://grindhaug.org/> 91 Brian Harring <ferringb@gmail.com> 87 92 Brant Harris 88 93 Hawkeye 89 heckj@mac.com94 Joe Heck <http://www.rhonabwy.com/wp/> 90 95 Joel Heenan <joelh-django@planetjoel.com> 91 96 hipertracker@gmail.com … … 94 99 Robert Rock Howard <http://djangomojo.com/> 95 100 Jason Huggins <http://www.jrandolph.com/blog/> 96 Baurzhan Ismagulov <ibr@radix50.net> 101 Tom Insam 102 Baurzhan Ismagulov <ibr@radix50.net> 97 103 jcrasta@gmail.com 98 104 Michael Josephson <http://www.sdjournal.com/> … … 113 119 Christopher Lenz <http://www.cmlenz.net/> 114 120 lerouxb@gmail.com 121 Waylan Limberg <waylan@gmail.com> 115 122 limodou 116 123 mattmcc … … 163 170 Tyson Tate <tyson@fallingbullets.com> 164 171 Tom Tobin 165 Tom Insam166 172 Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> 173 torne-django@wolfpuppy.org.uk 167 174 Karen Tracey <graybark@bellsouth.net> 168 175 Makoto Tsuyuki <mtsuyuki@gmail.com> django/branches/newforms-admin/django/conf/__init__.py
r3951 r4503 8 8 9 9 import os 10 import time # Needed for Windows 10 11 from django.conf import global_settings 11 12 … … 106 107 self.INSTALLED_APPS = new_installed_apps 107 108 108 # move the time zone info into os.environ 109 os.environ['TZ'] = self.TIME_ZONE 109 if hasattr(time, 'tzset'): 110 # Move the time zone info into os.environ. See ticket #2315 for why 111 # we don't do this unconditionally (breaks Windows). 112 os.environ['TZ'] = self.TIME_ZONE 110 113 111 114 def get_all_members(self): django/branches/newforms-admin/django/conf/project_template/settings.py
r4265 r4503 19 19 # Local time zone for this installation. All choices can be found here: 20 20 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 21 # If running in a Windows environment this must be set to the same as your 22 # system time zone. 21 23 TIME_ZONE = 'America/Chicago' 22 24 django/branches/newforms-admin/django/contrib/auth/forms.py
r4266 r4503 5 5 from django.core import validators 6 6 from django import oldforms 7 from django.utils.translation import gettext as _ 7 8 8 9 class UserCreationForm(oldforms.Manipulator): django/branches/newforms-admin/django/contrib/syndication/feeds.py
r4265 r4503 79 79 author_email = self.__get_dynamic_attr('author_email', obj), 80 80 categories = self.__get_dynamic_attr('categories', obj), 81 feed_copyright = self.__get_dynamic_attr('feed_copyright', obj), 81 82 ) 82 83 … … 117 118 author_link = author_link, 118 119 categories = self.__get_dynamic_attr('item_categories', item), 120 item_copyright = self.__get_dynamic_attr('item_copyright', item), 119 121 ) 120 122 return feed django/branches/newforms-admin/django/db/models/__init__.py
r4343 r4503 51 51 52 52 def __getattr__(self, attr): 53 if attr == 'delta': 54 # To fix ticket #3377. Note that normal accesses to LazyDate.delta 55 # (after construction) will still work, because they don't go 56 # through __getattr__). This is mainly needed for unpickling. 57 raise AttributeError 53 58 return getattr(self.__get_value__(), attr) django/branches/newforms-admin/django/db/models/query.py
r4432 r4503 168 168 def iterator(self): 169 169 "Performs the SELECT database lookup of this QuerySet." 170 # self._select is a dictionary, and dictionaries' key order is171 # undefined, so we convert it to a list of tuples.172 extra_select = self._select.items()173 174 cursor = connection.cursor()175 176 170 try: 177 171 select, sql, params = self._get_sql_clause() 178 172 except EmptyResultSet: 179 173 raise StopIteration 180 174 175 # self._select is a dictionary, and dictionaries' key order is 176 # undefined, so we convert it to a list of tuples. 177 extra_select = self._select.items() 178 179 cursor = connection.cursor() 181 180 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ",".join(select) + sql, params) 182 181 fill_cache = self._select_related … … 199 198 counter = self._clone() 200 199 counter._order_by = () 200 counter._select_related = False 201 202 offset = counter._offset 203 limit = counter._limit 201 204 counter._offset = None 202 205 counter._limit = None 203 counter._select_related = False204 206 205 207 try: … … 215 217 else: 216 218 cursor.execute("SELECT COUNT(*)" + sql, params) 217 return cursor.fetchone()[0] 219 count = cursor.fetchone()[0] 220 221 # Apply any offset and limit constraints manually, since using LIMIT or 222 # OFFSET in SQL doesn't change the output of COUNT. 223 if offset: 224 count = max(0, count - offset) 225 if limit: 226 count = min(limit, count) 227 228 return count 218 229 219 230 def get(self, *args, **kwargs): … … 524 535 525 536 class ValuesQuerySet(QuerySet): 526 def iterator(self): 537 def __init__(self, *args, **kwargs): 538 super(ValuesQuerySet, self).__init__(*args, **kwargs) 527 539 # select_related and select aren't supported in values(). 528 540 self._select_related = False 529 541 self._select = {} 542 543 def iterator(self): 544 try: 545 select, sql, params = self._get_sql_clause() 546 except EmptyResultSet: 547 raise StopIteration 530 548 531 549 # self._fields is a list of field names to fetch. … … 536 554 columns = [f.column for f in self.model._meta.fields] 537 555 field_names = [f.attname for f in self.model._meta.fields] 538 539 cursor = connection.cursor()540 541 try:542 select, sql, params = self._get_sql_clause()543 except EmptyResultSet:544 raise StopIteration545 556 546 557 select = ['%s.%s' % (backend.quote_name(self.model._meta.db_table), backend.quote_name(c)) for c in columns] 558 cursor = connection.cursor() 547 559 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ",".join(select) + sql, params) 548 560 while 1: … … 593 605 self._result_cache = [] 594 606 595 def iterator(self):596 raise StopIteration597 598 607 def count(self): 599 608 return 0 … … 606 615 c._result_cache = [] 607 616 return c 617 618 def _get_sql_clause(self): 619 raise EmptyResultSet 608 620 609 621 class QOperator(object): … … 882 894 new_column = new_opts.pk.column 883 895 join_column = field.column 884 885 raise FieldFound 896 raise FieldFound 897 elif path: 898 # For regular fields, if there are still items on the path, 899 # an error has been made. We munge "name" so that the error 900 # properly identifies the cause of the problem. 901 name += LOOKUP_SEPARATOR + path[0] 902 else: 903 raise FieldFound 886 904 887 905 except FieldFound: # Match found, loop has been shortcut. django/branches/newforms-admin/django/db/models/related.py
r4265 r4503 69 69 return [attr] 70 70 else: 71 return [None] * self.field.rel.num_in_admin 71 if self.field.rel.min_num_in_admin: 72 return [None] * max(self.field.rel.num_in_admin, self.field.rel.min_num_in_admin) 73 else: 74 return [None] * self.field.rel.num_in_admin 72 75 73 76 def get_db_prep_lookup(self, lookup_type, value): django/branches/newforms-admin/django/http/__init__.py
r4135 r4503 161 161 if not mimetype: 162 162 mimetype = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE, settings.DEFAULT_CHARSET) 163 if hasattr(content, '__iter__'):163 if not isinstance(content, basestring) and hasattr(content, '__iter__'): 164 164 self._container = content 165 165 self._is_string = False django/branches/newforms-admin/django/newforms/fields.py
r4441 r4503 357 357 valid_values = set([str(k) for k, v in self.choices]) 358 358 if value not in valid_values: 359 raise ValidationError(gettext(u'Select a valid choice. %s is not one of the available choices.') % value)359 raise ValidationError(gettext(u'Select a valid choice. That choice is not one of the available choices.')) 360 360 return value 361 361 django/branches/newforms-admin/django/template/context.py
r4265 r4503 50 50 return False 51 51 52 def __contains__(self, key): 53 return self.has_key(key) 54 52 55 def get(self, key, otherwise=None): 53 56 for d in self.dicts: django/branches/newforms-admin/django/template/defaultfilters.py
r4274 r4503 120 120 return truncate_words(value, length) 121 121 122 def truncatewords_html(value, arg): 123 """ 124 Truncates HTML after a certain number of words 125 126 Argument: Number of words to truncate after 127 """ 128 from django.utils.text import truncate_html_words 129 try: 130 length = int(arg) 131 except ValueError: # invalid literal for int() 132 return value # Fail silently. 133 if not isinstance(value, basestring): 134 value = str(value) 135 return truncate_html_words(value, length) 136 122 137 def upper(value): 123 138 "Converts a string into all uppercase" … … 127 142 "Escapes a value for use in a URL" 128 143 import urllib 144 if not isinstance(value, basestring): 145 value = str(value) 129 146 return urllib.quote(value) 130 147 … … 535 552 register.filter(title) 536 553 register.filter(truncatewords) 554 register.filter(truncatewords_html) 537 555 register.filter(unordered_list) 538 556 register.filter(upper) django/branches/newforms-admin/django/template/defaulttags.py
r4052 r4503 316 316 return self.mapping.get(self.tagtype, '') 317 317 318 class URLNode(Node): 319 def __init__(self, view_name, args, kwargs): 320 self.view_name = view_name 321 self.args = args 322 self.kwargs = kwargs 323 324 def render(self, context): 325 from django.core.urlresolvers import reverse, NoReverseMatch 326 args = [arg.resolve(context) for arg in self.args] 327 kwargs = dict([(k, v.resolve(context)) for k, v in self.kwargs.items()]) 328 try: 329 return reverse(self.view_name, args=args, kwargs=kwargs) 330 except NoReverseMatch: 331 try: 332 project_name = settings.SETTINGS_MODULE.split('.')[0] 333 return reverse(project_name + '.' + self.view_name, args=args, kwargs=kwargs) 334 except NoReverseMatch: 335 return '' 336 318 337 class WidthRatioNode(Node): 319 338 def __init__(self, val_expr, max_expr, max_width): … … 869 888 templatetag = register.tag(templatetag) 870 889 890 def url(parser, token): 891 """ 892 Returns an absolute URL matching given view with its parameters. This is a 893 way to define links that aren't tied to a particular url configuration: 894 895 {% url path.to.some_view arg1,arg2,name1=value1 %} 896 897 The first argument is a path to a view. It can be an absolute python path 898 or just ``app_name.view_name`` without the project name if the view is 899 located inside the project. Other arguments are comma-separated values 900 that will be filled in place of positional and keyword arguments in the 901 URL. All arguments for the URL should be present. 902 903 For example if you have a view ``app_name.client`` taking client's id and 904 the corresponding line in a urlconf looks like this: 905 906 ('^client/(\d+)/$', 'app_name.client') 907 908 and this app's urlconf is included into the project's urlconf under some 909 path: 910 911 ('^clients/', include('project_name.app_name.urls')) 912 913 then in a template you can create a link for a certain client like this: 914 915 {% url app_name.client client.id %} 916 917 The URL will look like ``/clients/client/123/``. 918 """ 919 bits = token.contents.split(' ', 2) 920 if len(bits) < 2: 921 raise TemplateSyntaxError, "'%s' takes at least one argument (path to a view)" % bits[0] 922 args = [] 923 kwargs = {} 924 if len(bits) > 2: 925 for arg in bits[2].split(','): 926 if '=' in arg: 927 k, v = arg.split('=', 1) 928 kwargs[k] = parser.compile_filter(v) 929 else: 930 args.append(parser.compile_filter(arg)) 931 return URLNode(bits[1], args, kwargs) 932 url = register.tag(url) 933 871 934 #@register.tag 872 935 def widthratio(parser, token): django/branches/newforms-admin/django/template/__init__.py
r4161 r4503 118 118 119 119 class VariableDoesNotExist(Exception): 120 pass 121 120 121 def __init__(self, msg, params=()): 122 self.msg = msg 123 self.params = params 124 125 def __str__(self): 126 return self.msg % self.params 127 122 128 class InvalidTemplateLibrary(Exception): 123 129 pass … … 661 667 current = current[int(bits[0])] 662 668 except (IndexError, ValueError, KeyError): 663 raise VariableDoesNotExist , "Failed lookup for key [%s] in %r" % (bits[0], current) # missing attribute669 raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bits[0], current)) # missing attribute 664 670 except Exception, e: 665 671 if getattr(e, 'silent_variable_failure', False): django/branches/newforms-admin/django/template/loader_tags.py
r4265 r4503 130 130 except AttributeError: # parser.__loaded_blocks isn't a list yet 131 131 parser.__loaded_blocks = [block_name] 132 nodelist = parser.parse(('endblock', ))132 nodelist = parser.parse(('endblock', 'endblock %s' % block_name)) 133 133 parser.delete_first_token() 134 134 return BlockNode(block_name, nodelist) django/branches/newforms-admin/django/test/client.py
r4265 r4503 1 import sys 1 2 from cStringIO import StringIO 3 from django.conf import settings 2 4 from django.core.handlers.base import BaseHandler 3 5 from django.core.handlers.wsgi import WSGIRequest 6 from django.core.signals import got_request_exception 4 7 from django.dispatch import dispatcher 5 8 from django.http import urlencode, SimpleCookie … … 98 101 self.handler = ClientHandler() 99 102 self.defaults = defaults 100 self.cookie = SimpleCookie() 103 self.cookies = SimpleCookie() 104 self.session = {} 105 self.exc_info = None 106 107 def store_exc_info(self, *args, **kwargs): 108 """ 109 Utility method that can be used to store exceptions when they are 110 generated by a view. 111 """ 112 self.exc_info = sys.exc_info() 101 113 102 114 def request(self, **request): … … 109 121 110 122 environ = { 111 'HTTP_COOKIE': self.cookie ,123 'HTTP_COOKIE': self.cookies, 112 124 'PATH_INFO': '/', 113 125 'QUERY_STRING': '', … … 126 138 on_template_render = curry(store_rendered_templates, data) 127 139 dispatcher.connect(on_template_render, signal=signals.template_rendered) 140 141 # Capture exceptions created by the handler 142 dispatcher.connect(self.store_exc_info, signal=got_request_exception) 128 143 129 144 response = self.handler(environ) … … 141 156 setattr(response, detail, None) 142 157 158 # Look for a signalled exception and reraise it 159 if self.exc_info: 160 raise self.exc_info[1], None, self.exc_info[2] 161 162 # Update persistent cookie and session data 143 163 if response.cookies: 144 self.cookie.update(response.cookies) 145 164 self.cookies.update(response.cookies) 165 166 if 'django.contrib.sessions' in settings.INSTALLED_APPS: 167 from django.contrib.sessions.middleware import SessionWrapper 168 cookie = self.cookies.get(settings.SESSION_COOKIE_NAME, None) 169 if cookie: 170 self.session = SessionWrapper(cookie.value) 171 146 172 return response 147 173 django/branches/newforms-admin/django/utils/feedgenerator.py
r4265 r4503 41 41 def __init__(self, title, link, description, language=None, author_email=None, 42 42 author_name=None, author_link=None, subtitle=None, categories=None, 43 feed_url=None ):43 feed_url=None, feed_copyright=None): 44 44 self.feed = { 45 45 'title': title, … … 53 53 'categories': categories or (), 54 54 'feed_url': feed_url, 55 'feed_copyright': feed_copyright, 55 56 } 56 57 self.items = [] … … 58 59 def add_item(self, title, link, description, author_email=None, 59 60 author_name=None, author_link=None, pubdate=None, comments=None, 60 unique_id=None, enclosure=None, categories=() ):61 unique_id=None, enclosure=None, categories=(), item_copyright=None): 61 62 """ 62 63 Adds an item to the feed. All args are expected to be Python Unicode … … 76 77 'enclosure': enclosure, 77 78 'categories': categories or (), 79 'item_copyright': item_copyright, 78 80 }) 79 81 … … 129 131 for cat in self.feed['categories']: 130 132 handler.addQuickElement(u"category", cat) 133 if self.feed['feed_copyright'] is not None: 134 handler.addQuickElement(u"copyright", self.feed['feed_copyright']) 131 135 self.write_items(handler) 132 136 self.endChannelElement(handler) … … 213 217 for cat in self.feed['categories']: 214 218 handler.addQuickElement(u"category", "", {u"term": cat}) 219 if self.feed['feed_copyright'] is not None: 220 handler.addQuickElement(u"rights", self.feed['feed_copyright']) 215 221 self.write_items(handler) 216 222 handler.endElement(u"feed") … … 253 259 u"type": item['enclosure'].mime_type}) 254 260 255 # Categories :261 # Categories. 256 262 for cat in item['categories']: 257 263 handler.addQuickElement(u"category", u"", {u"term": cat}) 264 265 # Rights. 266 if item['item_copyright'] is not None: 267 handler.addQuickElement(u"rights", item['item_copyright']) 258 268 259 269 handler.endElement(u"entry") django/branches/newforms-admin/django/utils/text.py
r4213 r4503 42 42 return ' '.join(words) 43 43 44 def truncate_html_words(s, num): 45 """ 46 Truncates html to a certain number of words (not counting tags and comments). 47 Closes opened tags if they were correctly closed in the given html. 48 """ 49 length = int(num) 50 if length <= 0: 51 return '' 52 html4_singlets = ('br', 'col', 'link', 'base', 'img', 'param', 'area', 'hr', 'input') 53 # Set up regular expressions 54 re_words = re.compile(r'&.*?;|<.*?>|([A-Za-z0-9][\w-]*)') 55 re_tag = re.compile(r'<(/)?([^ ]+?)(?: (/)| .*?)?>') 56 # Count non-HTML words and keep note of open tags 57 pos = 0 58 ellipsis_pos = 0 59 words = 0 60 open_tags = [] 61 while words <= length: 62 m = re_words.search(s, pos) 63 if not m: 64 # Checked through whole string 65 break 66 pos = m.end(0) 67 if m.group(1): 68 # It's an actual non-HTML word 69 words += 1 70 if words == length: 71 ellipsis_pos = pos 72 continue 73 # Check for tag 74 tag = re_tag.match(m.group(0)) 75 if not tag or ellipsis_pos: 76 # Don't worry about non tags or tags after our truncate point 77 continue 78 closing_tag, tagname, self_closing = tag.groups() 79 tagname = tagname.lower() # Element names are always case-insensitive 80 if self_closing or tagname in html4_singlets: 81 pass 82 elif closing_tag: 83 # Check for match in open tags list 84 try: 85 i = open_tags.index(tagname) 86 except ValueError: 87 pass 88 else: 89 # SGML: An end tag closes, back to the matching start tag, all unclosed intervening start tags with omitted end tags 90 open_tags = open_tags[i+1:] 91 else: 92 # Add it to the start of the open tags list 93 open_tags.insert(0, tagname) 94 if words <= length: 95 # Don't try to close tags if we don't need to truncate 96 return s 97 out = s[:ellipsis_pos] + ' ...' 98 # Close any tags still open 99 for tag in open_tags: 100 out += '</%s>' % tag 101 # Return string 102 return out 103 44 104 def get_valid_filename(s): 45 105 """ django/branches/newforms-admin/docs/contributing.txt
r4426 r4503 485 485 change the symlink to point to the old code. 486 486 487 A third option is to use a `path file`_ (``<something>.pth``) which should 488 work on all systems (including Windows, which doesn't have symlinks 489 available). First, make sure there are no files, directories or symlinks named 490 ``django`` in your ``site-packages`` directory. Then create a text file named 491 ``django.pth`` and save it to your ``site-packages`` directory. That file 492 should contain a path to your copy of Django on a single line and optional 493 comments. Here is an example that points to multiple branches. Just uncomment 494 the line for the branch you want to use ('Trunk' in this example) and make 495 sure all other lines are commented:: 496 497 # Trunk is a svn checkout of: 498 # http://code.djangoproject.com/svn/django/trunk/ 499 # 500 /path/to/trunk 501 502 # <branch> is a svn checkout of: 503 # http://code.djangoproject.com/svn/django/branches/<branch>/ 504 # 505 #/path/to/<branch> 506 507 # On windows a path may look like this: 508 # C:/path/to/<branch> 509 487 510 If you're using Django 0.95 or earlier and installed it using 488 511 ``python setup.py install``, you'll have a directory called something like … … 491 514 file. Then copy the branch's version of the ``django`` directory into 492 515 ``site-packages``. 516 517 .. _path file: http://docs.python.org/lib/module-site.html 493 518 494 519 Official releases django/branches/newforms-admin/docs/django-admin.txt
r4426 r4503 18 18 Django via its ``setup.py`` utility. If it's not on your path, you can find it in 19 19 ``site-packages/django/bin`` within your Python installation. Consider 20 symlinking to it from some place on your path, such as ``/usr/local/bin``. 20 symlinking it from some place on your path, such as ``/usr/local/bin``. 21 22 For Windows users, who do not have symlinking functionality available, you 23 can copy ``django-admin.py`` to a location on your existing path or edit the 24 ``PATH`` settings (under ``Settings - Control Panel - System - Advanced - Environment...``) 25 to point to its installed location. 21 26 22 27 Generally, when working on a single Django project, it's easier to use django/branches/newforms-admin/docs/fastcgi.txt
r4426 r4503 275 275 Then, create a small script that tells Apache how to spawn your FastCGI 276 276 program. Create a file ``mysite.fcgi`` and place it in your Web directory, and 277 be sure to make it executable ::277 be sure to make it executable:: 278 278 279 279 #!/usr/bin/python django/branches/newforms-admin/docs/forms.txt
r4426 r4503 174 174 # Check for validation errors 175 175 errors = manipulator.get_validation_errors(new_data) 176 manipulator.do_html2python(new_data) 176 177 if errors: 177 178 return render_to_response('places/errors.html', {'errors': errors}) 178 179 else: 179 manipulator.do_html2python(new_data)180 180 new_place = manipulator.save(new_data) 181 181 return HttpResponse("Place created: %s" % new_place) … … 230 230 # Check for errors. 231 231 errors = manipulator.get_validation_errors(new_data) 232 manipulator.do_html2python(new_data) 232 233 233 234 if not errors: 234 235 # No errors. This means we can save the data! 235 manipulator.do_html2python(new_data)236 236 new_place = manipulator.save(new_data) 237 237 … … 325 325 new_data = request.POST.copy() 326 326 errors = manipulator.get_validation_errors(new_data) 327 manipulator.do_html2python(new_data) 327 328 if not errors: 328 manipulator.do_html2python(new_data)329 329 manipulator.save(new_data) 330 330 … … 407 407 new_data = request.POST.copy() 408 408 errors = manipulator.get_validation_errors(new_data) 409 manipulator.do_html2python(new_data) 409 410 if not errors: 410 manipulator.do_html2python(new_data)411 411 412 412 # Send e-mail using new_data here... django/branches/newforms-admin/docs/outputting_pdf.txt
r4426 r4503 30 30 If that command doesn't raise any errors, the installation worked. 31 31 &
