Changeset 3580
- Timestamp:
- 08/13/06 19:32:07 (2 years ago)
- Files:
-
- django/branches/full-history/AUTHORS (modified) (4 diffs)
- django/branches/full-history/django/bin/compile-messages.py (modified) (1 diff)
- django/branches/full-history/django/conf/global_settings.py (modified) (1 diff)
- django/branches/full-history/django/conf/locale/ru/LC_MESSAGES/django.mo (modified) (previous)
- django/branches/full-history/django/conf/locale/ru/LC_MESSAGES/django.po (modified) (2 diffs)
- django/branches/full-history/django/conf/project_template/settings.py (modified) (1 diff)
- django/branches/full-history/django/contrib/admin/media/js/admin/RelatedObjectLookups.js (modified) (1 diff)
- django/branches/full-history/django/contrib/admin/templates/admin/auth (copied) (copied from django/trunk/django/contrib/admin/templates/admin/auth)
- django/branches/full-history/django/contrib/admin/templates/admin/auth/user (copied) (copied from django/trunk/django/contrib/admin/templates/admin/auth/user)
- django/branches/full-history/django/contrib/admin/templates/admin/auth/user/add_form.html (copied) (copied from django/trunk/django/contrib/admin/templates/admin/auth/user/add_form.html)
- django/branches/full-history/django/contrib/admin/templates/admin/change_form.html (modified) (1 diff)
- django/branches/full-history/django/contrib/admin/templates/admin/edit_inline_tabular.html (modified) (1 diff)
- django/branches/full-history/django/contrib/admin/urls.py (modified) (2 diffs)
- django/branches/full-history/django/contrib/admin/views/auth.py (copied) (copied from django/trunk/django/contrib/admin/views/auth.py)
- django/branches/full-history/django/contrib/admin/views/doc.py (modified) (9 diffs)
- django/branches/full-history/django/contrib/admin/views/main.py (modified) (1 diff)
- django/branches/full-history/django/contrib/auth/forms.py (modified) (1 diff)
- django/branches/full-history/django/contrib/flatpages/README.TXT (modified) (1 diff)
- django/branches/full-history/django/contrib/sessions/middleware.py (modified) (1 diff)
- django/branches/full-history/django/core/management.py (modified) (9 diffs)
- django/branches/full-history/django/core/servers/basehttp.py (modified) (1 diff)
- django/branches/full-history/django/core/urlresolvers.py (modified) (4 diffs)
- django/branches/full-history/django/db/backends/postgresql_psycopg2/base.py (modified) (1 diff)
- django/branches/full-history/django/db/models/base.py (modified) (1 diff)
- django/branches/full-history/django/db/models/fields/__init__.py (modified) (1 diff)
- django/branches/full-history/django/db/models/__init__.py (modified) (2 diffs)
- django/branches/full-history/django/db/models/loading.py (modified) (2 diffs)
- django/branches/full-history/django/db/models/manipulators.py (modified) (1 diff)
- django/branches/full-history/django/http/__init__.py (modified) (2 diffs)
- django/branches/full-history/django/template/defaultfilters.py (modified) (2 diffs)
- django/branches/full-history/django/template/loaders/filesystem.py (modified) (1 diff)
- django/branches/full-history/django/views/generic/create_update.py (modified) (4 diffs)
- django/branches/full-history/docs/db-api.txt (modified) (3 diffs)
- django/branches/full-history/docs/documentation.txt (copied) (copied from django/trunk/docs/documentation.txt)
- django/branches/full-history/docs/faq.txt (modified) (1 diff)
- django/branches/full-history/docs/generic_views.txt (modified) (1 diff)
- django/branches/full-history/docs/model-api.txt (modified) (1 diff)
- django/branches/full-history/docs/request_response.txt (modified) (2 diffs)
- django/branches/full-history/docs/sessions.txt (modified) (1 diff)
- django/branches/full-history/docs/settings.txt (modified) (1 diff)
- django/branches/full-history/docs/url_dispatch.txt (modified) (1 diff)
- django/branches/full-history/setup.py (modified) (1 diff)
- django/branches/full-history/tests/modeltests/empty/models.py (modified) (1 diff)
- django/branches/full-history/tests/modeltests/lookup/models.py (modified) (4 diffs)
- django/branches/full-history/tests/othertests/defaultfilters.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/full-history/AUTHORS
r3519 r3580 61 61 ChaosKCW 62 62 Ian Clelland <clelland@gmail.com> 63 crankycoder@gmail.com 63 64 Matt Croydon <http://www.postneo.com/> 64 65 Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/> … … 72 73 Baishampayan Ghose 73 74 martin.glueck@gmail.com 75 Simon Greenhill <dev@simon.net.nz> 74 76 Espen Grindhaug <http://grindhaug.org/> 75 77 Brant Harris … … 125 127 David Schein 126 128 sopel 129 Thomas Steinacher <tom@eggdrop.ch> 127 130 Radek Å varz <http://www.svarz.cz/translate/> 128 131 Swaroop C H <http://www.swaroopch.info> … … 131 134 Tom Insam 132 135 Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> 136 Karen Tracey <graybark@bellsouth.net> 133 137 Amit Upadhyay 134 138 Geert Vanderkelen django/branches/full-history/django/bin/compile-messages.py
r3426 r3580 15 15 sys.exit(1) 16 16 17 for (dirpath, dirnames, filenames)in os.walk(basedir):17 for dirpath, dirnames, filenames in os.walk(basedir): 18 18 for f in filenames: 19 19 if f.endswith('.po'): django/branches/full-history/django/conf/global_settings.py
r3426 r3580 253 253 SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks). 254 254 SESSION_COOKIE_DOMAIN = None # A string like ".lawrence.com", or None for standard domain cookie. 255 SESSION_COOKIE_SECURE = False # Whether the session cookie should be secure (https:// only). 255 256 SESSION_SAVE_EVERY_REQUEST = False # Whether to save the session data on every request. 256 257 SESSION_EXPIRE_AT_BROWSER_CLOSE = False # Whether sessions expire when a user closes his browser. django/branches/full-history/django/conf/locale/ru/LC_MESSAGES/django.po
r3151 r3580 142 142 143 143 #: contrib/comments/models.py:237 144 #, fuzzy 144 145 msgid "karma score" 145 146 msgstr "ÐаÑЌа ÑÑÑÑ" … … 744 745 #, python-format 745 746 msgid "Models available in the %(name)s application." 746 msgstr "ÐПЎелО ЎПÑÑÑÐ¿ÐœÑ Ð² %(name) sпÑОлПжеМОО."747 msgstr "ÐПЎелО ЎПÑÑÑÐ¿ÐœÑ Ð² %(name) пÑОлПжеМОО." 747 748 748 749 #: contrib/admin/templates/admin/index.html:28 django/branches/full-history/django/conf/project_template/settings.py
r2980 r3580 61 61 62 62 TEMPLATE_DIRS = ( 63 # Put strings here, like "/home/html/django_templates" .63 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 64 64 # Always use forward slashes, even on Windows. 65 # Don't forget to use absolute paths, not relative paths. 65 66 ) 66 67 django/branches/full-history/django/contrib/admin/media/js/admin/RelatedObjectLookups.js
r3066 r3580 12 12 href = triggeringLink.href + '?pop=1'; 13 13 } 14 var win = window.open(href, name, 'height=500,width= 740,resizable=yes,scrollbars=yes');14 var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); 15 15 win.focus(); 16 16 return false; django/branches/full-history/django/contrib/admin/templates/admin/change_form.html
r3426 r3580 22 22 </ul> 23 23 {% endif %}{% endif %} 24 <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" >{% block form_top %}{% endblock %}24 <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %} 25 25 <div> 26 26 {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} django/branches/full-history/django/contrib/admin/templates/admin/edit_inline_tabular.html
r3426 r3580 8 8 {% endif %} 9 9 {% endfor %} 10 </tr></thead> 10 11 {% for fcw in bound_related_object.form_field_collection_wrappers %} 11 12 {% if change %}{% if original_row_needed %} django/branches/full-history/django/contrib/admin/urls.py
r3247 r3580 22 22 ('^doc/filters/$', 'django.contrib.admin.views.doc.template_filter_index'), 23 23 ('^doc/views/$', 'django.contrib.admin.views.doc.view_index'), 24 ('^doc/views/jump/$', 'django.contrib.admin.views.doc.jump_to_view'),25 24 ('^doc/views/(?P<view>[^/]+)/$', 'django.contrib.admin.views.doc.view_detail'), 26 25 ('^doc/models/$', 'django.contrib.admin.views.doc.model_index'), … … 28 27 # ('^doc/templates/$', 'django.views.admin.doc.template_index'), 29 28 ('^doc/templates/(?P<template>.*)/$', 'django.contrib.admin.views.doc.template_detail'), 29 30 # "Add user" -- a special-case view 31 ('^auth/user/add/$', 'django.contrib.admin.views.auth.user_add_stage'), 30 32 31 33 # Add/change/delete/history django/branches/full-history/django/contrib/admin/views/doc.py
r3426 r3580 44 44 title, body, metadata = utils.parse_docstring(tag_func.__doc__) 45 45 if title: 46 title = utils.parse_rst(title, 'tag', 'tag:'+ tag_name)46 title = utils.parse_rst(title, 'tag', _('tag:') + tag_name) 47 47 if body: 48 body = utils.parse_rst(body, 'tag', 'tag:'+ tag_name)48 body = utils.parse_rst(body, 'tag', _('tag:') + tag_name) 49 49 for key in metadata: 50 metadata[key] = utils.parse_rst(metadata[key], 'tag', 'tag:'+ tag_name)50 metadata[key] = utils.parse_rst(metadata[key], 'tag', _('tag:') + tag_name) 51 51 if library in template.builtins: 52 52 tag_library = None … … 75 75 title, body, metadata = utils.parse_docstring(filter_func.__doc__) 76 76 if title: 77 title = utils.parse_rst(title, 'filter', 'filter:'+ filter_name)77 title = utils.parse_rst(title, 'filter', _('filter:') + filter_name) 78 78 if body: 79 body = utils.parse_rst(body, 'filter', 'filter:'+ filter_name)79 body = utils.parse_rst(body, 'filter', _('filter:') + filter_name) 80 80 for key in metadata: 81 metadata[key] = utils.parse_rst(metadata[key], 'filter', 'filter:'+ filter_name)81 metadata[key] = utils.parse_rst(metadata[key], 'filter', _('filter:') + filter_name) 82 82 if library in template.builtins: 83 83 tag_library = None … … 133 133 title, body, metadata = utils.parse_docstring(view_func.__doc__) 134 134 if title: 135 title = utils.parse_rst(title, 'view', 'view:'+ view)135 title = utils.parse_rst(title, 'view', _('view:') + view) 136 136 if body: 137 body = utils.parse_rst(body, 'view', 'view:'+ view)137 body = utils.parse_rst(body, 'view', _('view:') + view) 138 138 for key in metadata: 139 metadata[key] = utils.parse_rst(metadata[key], 'model', 'view:'+ view)139 metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view) 140 140 return render_to_response('admin_doc/view_detail.html', { 141 141 'name': view, … … 162 162 app_mod = models.get_app(app_label) 163 163 except ImproperlyConfigured: 164 raise Http404, "App %r not found"% app_label164 raise Http404, _("App %r not found") % app_label 165 165 model = None 166 166 for m in models.get_models(app_mod): … … 169 169 break 170 170 if model is None: 171 raise Http404, "Model %r not found in app %r"% (model_name, app_label)171 raise Http404, _("Model %r not found in app %r") % (model_name, app_label) 172 172 173 173 opts = model._meta … … 181 181 data_type = related_object_name = field.rel.to.__name__ 182 182 app_label = field.rel.to._meta.app_label 183 verbose = utils.parse_rst(( "the related `%s.%s` object" % (app_label, data_type)), 'model', 'model:'+ data_type)183 verbose = utils.parse_rst((_("the related `%s.%s` object") % (app_label, data_type)), 'model', _('model:') + data_type) 184 184 else: 185 185 data_type = get_readable_field_data_type(field) … … 203 203 verbose = func.__doc__ 204 204 if verbose: 205 verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', 'model:'+ opts.module_name)205 verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', _('model:') + opts.module_name) 206 206 fields.append({ 207 207 'name': func_name, … … 212 212 # Gather related objects 213 213 for rel in opts.get_all_related_objects(): 214 verbose = "related `%s.%s` objects"% (rel.opts.app_label, rel.opts.object_name)214 verbose = _("related `%s.%s` objects") % (rel.opts.app_label, rel.opts.object_name) 215 215 accessor = rel.get_accessor_name() 216 216 fields.append({ 217 217 'name' : "%s.all" % accessor, 218 218 'data_type' : 'List', 219 'verbose' : utils.parse_rst( "all " + verbose , 'model', 'model:'+ opts.module_name),219 'verbose' : utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.module_name), 220 220 }) 221 221 fields.append({ 222 222 'name' : "%s.count" % accessor, 223 223 'data_type' : 'Integer', 224 'verbose' : utils.parse_rst( "number of " + verbose , 'model', 'model:'+ opts.module_name),224 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name), 225 225 }) 226 226 … … 337 337 views.extend(extract_views_from_urlpatterns(p.url_patterns, base + p.regex.pattern)) 338 338 else: 339 raise TypeError, "%s does not appear to be a urlpattern object"% p339 raise TypeError, _("%s does not appear to be a urlpattern object") % p 340 340 return views 341 341 django/branches/full-history/django/contrib/admin/views/main.py
r3426 r3580 264 264 return HttpResponseRedirect(post_url_continue % pk_value) 265 265 if request.POST.has_key("_popup"): 266 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, % s, "%s");</script>' % \266 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %r, "%s");</script>' % \ 267 267 (pk_value, str(new_object).replace('"', '\\"'))) 268 268 elif request.POST.has_key("_addanother"): django/branches/full-history/django/contrib/auth/forms.py
r3519 r3580 5 5 from django.core import validators 6 6 from django import forms 7 8 class UserCreationForm(forms.Manipulator): 9 "A form that creates a user, with no privileges, from the given username and password." 10 def __init__(self): 11 self.fields = ( 12 forms.TextField(field_name='username', length=30, maxlength=30, is_required=True, 13 validator_list=[validators.isAlphaNumeric, self.isValidUsername]), 14 forms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), 15 forms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, 16 validator_list=[validators.AlwaysMatchesOtherField('password1', "The two password fields didn't match.")]), 17 ) 18 19 def isValidUsername(self, field_data, all_data): 20 try: 21 User.objects.get(username=field_data) 22 except User.DoesNotExist: 23 return 24 raise validators.ValidationError, 'A user with that username already exists.' 25 26 def save(self, new_data): 27 "Creates the user." 28 return User.objects.create_user(new_data['username'], '', new_data['password1']) 7 29 8 30 class AuthenticationForm(forms.Manipulator): django/branches/full-history/django/contrib/flatpages/README.TXT
r1189 r3580 3 3 For full documentation, see either of these: 4 4 5 * The file d jango/docs/flatpages.txt in the Django distribution5 * The file docs/flatpages.txt in the Django distribution 6 6 * http://www.djangoproject.com/documentation/flatpages/ on the Web 7 7 django/branches/full-history/django/contrib/sessions/middleware.py
r3113 r3580 89 89 datetime.datetime.now() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE)) 90 90 response.set_cookie(settings.SESSION_COOKIE_NAME, session_key, 91 max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN) 91 max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN, 92 secure=settings.SESSION_COOKIE_SECURE or None) 92 93 return response django/branches/full-history/django/core/management.py
r3519 r3580 95 95 sys.exit(1) 96 96 97 # Get installed models, so we generate REFERENCES right 97 # Get installed models, so we generate REFERENCES right. 98 # We trim models from the current app so that the sqlreset command does not 99 # generate invalid SQL (leaving models out of known_models is harmless, so 100 # we can be conservative). 101 app_models = models.get_models(app) 98 102 final_output = [] 99 known_models = set( _get_installed_models(_get_table_list()))103 known_models = set([model for model in _get_installed_models(_get_table_list()) if model not in app_models]) 100 104 pending_references = {} 101 105 102 app_models = models.get_models(app)103 106 104 107 for model in app_models: … … 119 122 not_installed_models = set(pending_references.keys()) 120 123 if not_installed_models: 121 final_output.append('-- The following references should be added but depend on non-existant tables:')124 alter_sql = [] 122 125 for model in not_installed_models: 123 final_output.extend(['-- ' + sql for sql in126 alter_sql.extend(['-- ' + sql for sql in 124 127 _get_sql_for_pending_references(model, pending_references)]) 128 if alter_sql: 129 final_output.append('-- The following references should be added but depend on non-existent tables:') 130 final_output.extend(alter_sql) 125 131 126 132 return final_output … … 296 302 style.SQL_TABLE(backend.quote_name(table)), 297 303 style.SQL_KEYWORD(backend.get_drop_foreignkey_sql()), 298 style.SQL_FIELD(backend.quote_name( "%s_referencing_%s_%s" % (col, r_table, r_col)))))304 style.SQL_FIELD(backend.quote_name('%s_refs_%s_%x' % (col, r_col, abs(hash((table, r_table)))))))) 299 305 del references_to_delete[model] 300 306 … … 693 699 introspection_module = get_introspection_module() 694 700 695 def table2model(table_name): 696 object_name = table_name.title().replace('_', '') 697 return object_name.endswith('s') and object_name[:-1] or object_name 701 table2model = lambda table_name: table_name.title().replace('_', '') 698 702 699 703 cursor = connection.cursor() … … 724 728 extra_params = {} # Holds Field parameters such as 'db_column'. 725 729 730 if ' ' in att_name: 731 extra_params['db_column'] = att_name 732 att_name = att_name.replace(' ', '') 733 comment_notes.append('Field renamed to remove spaces.') 726 734 if keyword.iskeyword(att_name): 727 735 extra_params['db_column'] = att_name … … 954 962 except models.FieldDoesNotExist: 955 963 e.add(opts, '"admin.list_filter" refers to %r, which isn\'t a field.' % fn) 964 # date_hierarchy 965 if opts.admin.date_hierarchy: 966 try: 967 f = opts.get_field(opts.admin.date_hierarchy) 968 except models.FieldDoesNotExist: 969 e.add(opts, '"admin.date_hierarchy" refers to %r, which isn\'t a field.' % opts.admin.date_hierarchy) 956 970 957 971 # Check ordering attribute. … … 1129 1143 1130 1144 def runfcgi(args): 1131 """Run this project as a FastCGI application. requires flup.""" 1145 "Runs this project as a FastCGI application. Requires flup." 1146 from django.conf import settings 1147 from django.utils import translation 1148 # Activate the current language, because it won't get activated later. 1149 try: 1150 translation.activate(settings.LANGUAGE_CODE) 1151 except AttributeError: 1152 pass 1132 1153 from django.core.servers.fastcgi import runfastcgi 1133 1154 runfastcgi(args) … … 1286 1307 print style.SQL_KEYWORD("COMMIT;") 1287 1308 1288 def execute_manager(settings_mod, argv=None): 1309 def setup_environ(settings_mod): 1310 """ 1311 Configure the runtime environment. This can also be used by external 1312 scripts wanting to set up a similar environment to manage.py. 1313 """ 1289 1314 # Add this project to sys.path so that it's importable in the conventional 1290 1315 # way. For example, if this file (manage.py) lives in a directory … … 1298 1323 # Set DJANGO_SETTINGS_MODULE appropriately. 1299 1324 os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name 1300 1325 return project_directory 1326 1327 def execute_manager(settings_mod, argv=None): 1328 project_directory = setup_environ(settings_mod) 1301 1329 action_mapping = DEFAULT_ACTION_MAPPING.copy() 1302 1330 django/branches/full-history/django/core/servers/basehttp.py
r3426 r3580 548 548 env['PATH_INFO'] = urllib.unquote(path) 549 549 env['QUERY_STRING'] = query 550 551 host = self.address_string()552 if host != self.client_address[0]:553 env['REMOTE_HOST'] = host554 550 env['REMOTE_ADDR'] = self.client_address[0] 555 551 django/branches/full-history/django/core/urlresolvers.py
r3519 r3580 87 87 def __init__(self, regex, callback, default_args=None): 88 88 # regex is a string representing a regular expression. 89 # callback is something like 'foo.views.news.stories.story_detail', 90 # which represents the path to a module and a view function name. 89 # callback is either a string like 'foo.views.news.stories.story_detail' 90 # which represents the path to a module and a view function name, or a 91 # callable object (view). 91 92 self.regex = re.compile(regex) 92 self.callback = callback 93 if callable(callback): 94 self._callback = callback 95 else: 96 self._callback = None 97 self._callback_str = callback 93 98 self.default_args = default_args or {} 94 99 … … 107 112 kwargs.update(self.default_args) 108 113 109 try: # Lazily load self.func. 110 return self.func, args, kwargs 111 except AttributeError: 112 self.func = self.get_callback() 113 return self.func, args, kwargs 114 115 def get_callback(self): 116 mod_name, func_name = get_mod_func(self.callback) 117 try: 118 return getattr(__import__(mod_name, '', '', ['']), func_name) 114 return self.callback, args, kwargs 115 116 def _get_callback(self): 117 if self._callback is not None: 118 return self._callback 119 mod_name, func_name = get_mod_func(self._callback_str) 120 try: 121 self._callback = getattr(__import__(mod_name, '', '', ['']), func_name) 119 122 except ImportError, e: 120 123 raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e)) 121 124 except AttributeError, e: 122 125 raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e)) 126 return self._callback 127 callback = property(_get_callback) 123 128 124 129 def reverse(self, viewname, *args, **kwargs): 125 if viewname != self.callback: 130 mod_name, func_name = get_mod_func(viewname) 131 try: 132 lookup_view = getattr(__import__(mod_name, '', '', ['']), func_name) 133 except (ImportError, AttributeError): 134 raise NoReverseMatch 135 if lookup_view != self.callback: 126 136 raise NoReverseMatch 127 137 return self.reverse_helper(*args, **kwargs) … … 186 196 return self._resolve_special('500') 187 197 188 def reverse(self, viewname, *args, **kwargs): 198 def reverse(self, lookup_view, *args, **kwargs): 199 if not callable(lookup_view): 200 mod_name, func_name = get_mod_func(lookup_view) 201 try: 202 lookup_view = getattr(__import__(mod_name, '', '', ['']), func_name) 203 except (ImportError, AttributeError): 204 raise NoReverseMatch 189 205 for pattern in self.urlconf_module.urlpatterns: 190 206 if isinstance(pattern, RegexURLResolver): 191 207 try: 192 return pattern.reverse_helper( viewname, *args, **kwargs)208 return pattern.reverse_helper(lookup_view, *args, **kwargs) 193 209 except NoReverseMatch: 194 210 continue 195 elif pattern.callback == viewname:211 elif pattern.callback == lookup_view: 196 212 try: 197 213 return pattern.reverse_helper(*args, **kwargs) … … 200 216 raise NoReverseMatch 201 217 202 def reverse_helper(self, viewname, *args, **kwargs):203 sub_match = self.reverse( viewname, *args, **kwargs)218 def reverse_helper(self, lookup_view, *args, **kwargs): 219 sub_match = self.reverse(lookup_view, *args, **kwargs) 204 220 result = reverse_helper(self.regex, *args, **kwargs) 205 221 return result + sub_match django/branches/full-history/django/db/backends/postgresql_psycopg2/base.py
r3115 r3580 11 11 from django.core.exceptions import ImproperlyConfigured 12 12 raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e 13 14 # Register Unicode conversions 15 import psycopg2.extensions 16 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) 13 17 14 18 DatabaseError = Database.DatabaseError django/branches/full-history/django/db/models/base.py
r3519 r3580 177 177 if cursor.fetchone(): 178 178 db_values = [f.get_db_prep_save(f.pre_save(self, False)) for f in non_pks] 179 cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \ 180 (backend.quote_name(self._meta.db_table), 181 ','.join(['%s=%%s' % backend.quote_name(f.column) for f in non_pks]), 182 backend.quote_name(self._meta.pk.column)), 183 db_values + [pk_val]) 179 if db_values: 180 cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \ 181 (backend.quote_name(self._meta.db_table), 182 ','.join(['%s=%%s' % backend.quote_name(f.column) for f in non_pks]), 183 backend.quote_name(self._meta.pk.column)), 184 db_values + [pk_val]) 184 185 else: 185 186 record_exists = False django/branches/full-history/django/db/models/fields/__init__.py
r3519 r3580 21 21 22 22 # prepares a value for use in a LIKE query 23 prep_for_like_query = lambda x: str(x).replace(" %", "\%").replace("_", "\_")23 prep_for_like_query = lambda x: str(x).replace("\\", "\\\\").replace("%", "\%").replace("_", "\_") 24 24 25 25 # returns the <ul> class for a given radio_admin value django/branches/full-history/django/db/models/__init__.py
r3519 r3580 26 26 bits = func(*args, **kwargs) 27 27 viewname = bits[0] 28 return reverse(bits[0], None, *bits[1: 2])28 return reverse(bits[0], None, *bits[1:3]) 29 29 return inner 30 30 … … 48 48 49 49 def __get_value__(self): 50 return datetime.datetime.now() + self.delta50 return (datetime.datetime.now() + self.delta).date() 51 51 52 52 def __getattr__(self, attr): django/branches/full-history/django/db/models/loading.py
r3519 r3580 33 33 return _app_list 34 34 35 def get_app(app_label, emptyOK =False):35 def get_app(app_label, emptyOK=False): 36 36 "Returns the module containing the models for the given app_label. If the app has no models in it and 'emptyOK' is True, returns None." 37 37 get_apps() # Run get_apps() to populate the _app_list cache. Slightly hackish. … … 76 76 return model_list 77 77 78 def get_model(app_label, model_name, seed_cache =True):78 def get_model(app_label, model_name, seed_cache=True): 79 79 """ 80 80 Returns the model matching the given app_label and case-insensitive django/branches/full-history/django/db/models/manipulators.py
r3426 r3580 139 139 140 140 if child_follow: 141 obj_list = expanded_data [related.var_name].items()141 obj_list = expanded_data.get(related.var_name, {}).items() 142 142 if not obj_list: 143 143 continue django/branches/full-history/django/http/__init__.py
r3426 r3580 39 39 def get_full_path(self): 40 40 return '' 41 41 42 42 def is_secure(self): 43 43 return os.environ.get("HTTPS") == "on" … … 204 204 self.cookies[key][var.replace('_', '-')] = val 205 205 206 def delete_cookie(self, key): 207 try: 208 self.cookies[key]['max_age'] = 0 209 except KeyError: 210 pass 206 def delete_cookie(self, key, path='/', domain=None): 207 self.cookies[key] = '' 208 if path is not None: 209 self.cookies[key]['path'] = path 210 if domain is not None: 211 self.cookies[key]['domain'] = path 212 self.cookies[key]['expires'] = 0 213 self.cookies[key]['max-age'] = 0 211 214 212 215 def _get_content(self): django/branches/full-history/django/template/defaultfilters.py
r3426 r3580 340 340 "Formats a time according to the given format" 341 341 from django.utils.dateformat import time_format 342 if not value:342 if value in (None, ''): 343 343 return '' 344 344 if arg is None: … … 438 438 the comma is used for the singular case. 439 439 """ 440 if not ',' in arg: 440 if not ',' in arg: 441 441 arg = ',' + arg 442 442 bits = arg.split(',') django/branches/full-history/django/template/loaders/filesystem.py
r2809 r3580 18 18 except IOError: 19 19 tried.append(filepath) 20 if t emplate_dirs:20 if tried: 21 21 error_msg = "Tried %s" % tried 22 22 else: django/branches/full-history/django/views/generic/create_update.py
r3426 r3580 7 7 from django.http import Http404, HttpResponse, HttpResponseRedirect 8 8 from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured 9 from django.utils.translation import gettext 9 10 10 11 def create_object(request, model, template_name=None, … … 40 41 41 42 if request.user.is_authenticated(): 42 request.user.message_set.create(message= "The %s was created successfully." % model._meta.verbose_name)43 request.user.message_set.create(message=gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": model._meta.verbose_name}) 43 44 44 45 # Redirect to the new object: first by trying post_save_redirect, … … 114 115 115 116 if request.user.is_authenticated(): 116 request.user.message_set.create(message= "The %s was updated successfully." % model._meta.verbose_name)117 request.user.message_set.create(message=gettext("The %(verbose_name)s was updated successfully.") % {"verbose_name": model._meta.verbose_name}) 117 118 118 119 # Do a post-after-redirect so that reload works, etc. … … 181 182 object.delete() 182 183 if request.user.is_authenticated(): 183 request.user.message_set.create(message= "The %s was deleted." % model._meta.verbose_name)184 request.user.message_set.create(message=gettext("The %(verbose_name)s was deleted.") % {"verbose_name": model._meta.verbose_name}) 184 185 return HttpResponseRedirect(post_delete_redirect) 185 186 else: django/branches/full-history/docs/db-api.txt
r3519
