Author: bouldersprinters
Date: 2007-04-23 11:16:27 -0500 (Mon, 23 Apr 2007)
New Revision: 5062
Modified:
django/branches/boulder-oracle-sprint/AUTHORS
django/branches/boulder-oracle-sprint/django/contrib/auth/models.py
django/branches/boulder-oracle-sprint/django/newforms/fields.py
django/branches/boulder-oracle-sprint/django/template/defaultfilters.py
django/branches/boulder-oracle-sprint/django/template/defaulttags.py
django/branches/boulder-oracle-sprint/django/utils/datastructures.py
django/branches/boulder-oracle-sprint/django/views/debug.py
django/branches/boulder-oracle-sprint/docs/distributions.txt
django/branches/boulder-oracle-sprint/docs/generic_views.txt
django/branches/boulder-oracle-sprint/tests/regressiontests/templates/tests.py
Log:
boulder-oracle-sprint: Merged to [5061]
Modified: django/branches/boulder-oracle-sprint/AUTHORS
===================================================================
--- django/branches/boulder-oracle-sprint/AUTHORS 2007-04-23 05:51:29 UTC
(rev 5061)
+++ django/branches/boulder-oracle-sprint/AUTHORS 2007-04-23 16:16:27 UTC
(rev 5062)
@@ -78,6 +78,7 @@
Jason Davies (Esaj) <http://www.jasondavies.com/>
Alex Dedul
[EMAIL PROTECTED]
+ Max Derkachev <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
Maximillian Dornseif <[EMAIL PROTECTED]>
Jeremy Dunck <http://dunck.us/>
@@ -113,6 +114,7 @@
Tom Insam
Baurzhan Ismagulov <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
+ Zak Johnson <[EMAIL PROTECTED]>
Michael Josephson <http://www.sdjournal.com/>
[EMAIL PROTECTED]
[EMAIL PROTECTED]
@@ -180,6 +182,7 @@
Brian Ray <http://brianray.chipy.org/>
[EMAIL PROTECTED]
[EMAIL PROTECTED]
+ Armin Ronacher
Oliver Rutherfurd <http://rutherfurd.net/>
Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/>
David Schein
Modified: django/branches/boulder-oracle-sprint/django/contrib/auth/models.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/contrib/auth/models.py
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/contrib/auth/models.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -273,7 +273,7 @@
pass
def __str__(self):
- return 'AnonymousUser'
+ return _('AnonymousUser')
def __eq__(self, other):
return isinstance(other, self.__class__)
Modified: django/branches/boulder-oracle-sprint/django/newforms/fields.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/newforms/fields.py
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/newforms/fields.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -332,7 +332,9 @@
return {True: True, False: False}.get(value, None)
class ChoiceField(Field):
- def __init__(self, choices=(), required=True, widget=Select, label=None,
initial=None, help_text=None):
+ widget = Select
+
+ def __init__(self, choices=(), required=True, widget=None, label=None,
initial=None, help_text=None):
super(ChoiceField, self).__init__(required, widget, label, initial,
help_text)
self.choices = choices
@@ -364,10 +366,8 @@
class MultipleChoiceField(ChoiceField):
hidden_widget = MultipleHiddenInput
+ widget = SelectMultiple
- def __init__(self, choices=(), required=True, widget=SelectMultiple,
label=None, initial=None, help_text=None):
- super(MultipleChoiceField, self).__init__(choices, required, widget,
label, initial, help_text)
-
def clean(self, value):
"""
Validates that the input is a list or tuple.
Modified:
django/branches/boulder-oracle-sprint/django/template/defaultfilters.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/template/defaultfilters.py
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/template/defaultfilters.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -2,7 +2,7 @@
from django.template import resolve_variable, Library
from django.conf import settings
-from django.utils.translation import gettext
+from django.utils.translation import gettext, ngettext
import re
import random as random_module
@@ -517,12 +517,12 @@
return "0 bytes"
if bytes < 1024:
- return "%d byte%s" % (bytes, bytes != 1 and 's' or '')
+ return ngettext("%(size)d byte", "%(size)d bytes", bytes) % {'size':
bytes}
if bytes < 1024 * 1024:
- return "%.1f KB" % (bytes / 1024)
+ return gettext("%.1f KB") % (bytes / 1024)
if bytes < 1024 * 1024 * 1024:
- return "%.1f MB" % (bytes / (1024 * 1024))
- return "%.1f GB" % (bytes / (1024 * 1024 * 1024))
+ return gettext("%.1f MB") % (bytes / (1024 * 1024))
+ return gettext("%.1f GB") % (bytes / (1024 * 1024 * 1024))
def pluralize(value, arg='s'):
"""
Modified: django/branches/boulder-oracle-sprint/django/template/defaulttags.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/template/defaulttags.py
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/template/defaulttags.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -41,7 +41,10 @@
def render(self, context):
output = self.nodelist.render(context)
# apply filters
- return self.filter_expr.resolve(Context({'var': output}))
+ context.update({'var': output})
+ filtered = self.filter_expr.resolve(context)
+ context.pop()
+ return filtered
class FirstOfNode(Node):
def __init__(self, vars):
@@ -990,7 +993,7 @@
"""
Add a value to the context (inside of this block) for caching and easy
access.
-
+
For example::
{% with person.some_sql_method as total %}
@@ -999,7 +1002,7 @@
"""
bits = list(token.split_contents())
if len(bits) != 4 or bits[2] != "as":
- raise TemplateSyntaxError, "%r expected format is 'value as name'" %
tagname
+ raise TemplateSyntaxError, "%r expected format is 'value as name'" %
bits[0]
var = parser.compile_filter(bits[1])
name = bits[3]
nodelist = parser.parse(('endwith',))
Modified: django/branches/boulder-oracle-sprint/django/utils/datastructures.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/utils/datastructures.py
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/utils/datastructures.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -211,7 +211,7 @@
def update(self, *args, **kwargs):
"update() extends rather than replaces existing key lists. Also
accepts keyword args."
if len(args) > 1:
- raise TypeError, "update expected at most 1 arguments, got %d",
len(args)
+ raise TypeError, "update expected at most 1 arguments, got %d" %
len(args)
if args:
other_dict = args[0]
if isinstance(other_dict, MultiValueDict):
Modified: django/branches/boulder-oracle-sprint/django/views/debug.py
===================================================================
--- django/branches/boulder-oracle-sprint/django/views/debug.py 2007-04-23
05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/django/views/debug.py 2007-04-23
16:16:27 UTC (rev 5062)
@@ -90,11 +90,18 @@
exc_type, exc_value, tb, template_info =
get_template_exception_info(exc_type, exc_value, tb)
frames = []
while tb is not None:
+ # support for __traceback_hide__ which is used by a few libraries
+ # to hide internal frames.
+ if tb.tb_frame.f_locals.get('__traceback_hide__'):
+ tb = tb.tb_next
+ continue
filename = tb.tb_frame.f_code.co_filename
function = tb.tb_frame.f_code.co_name
lineno = tb.tb_lineno - 1
- pre_context_lineno, pre_context, context_line, post_context =
_get_lines_from_file(filename, lineno, 7)
- if pre_context_lineno:
+ loader = tb.tb_frame.f_globals.get('__loader__')
+ module_name = tb.tb_frame.f_globals.get('__name__')
+ pre_context_lineno, pre_context, context_line, post_context =
_get_lines_from_file(filename, lineno, 7, loader, module_name)
+ if pre_context_lineno is not None:
frames.append({
'tb': tb,
'filename': filename,
@@ -161,24 +168,35 @@
})
return HttpResponseNotFound(t.render(c), mimetype='text/html')
-def _get_lines_from_file(filename, lineno, context_lines):
+def _get_lines_from_file(filename, lineno, context_lines, loader=None,
module_name=None):
"""
Returns context_lines before and after lineno from file.
Returns (pre_context_lineno, pre_context, context_line, post_context).
"""
- try:
- source = open(filename).readlines()
- lower_bound = max(0, lineno - context_lines)
- upper_bound = lineno + context_lines
+ source = None
+ if loader is not None:
+ source = loader.get_source(module_name).splitlines()
+ else:
+ try:
+ f = open(filename)
+ try:
+ source = f.readlines()
+ finally:
+ f.close()
+ except (OSError, IOError):
+ pass
+ if source is None:
+ return None, [], None, []
- pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
- context_line = source[lineno].strip('\n')
- post_context = [line.strip('\n') for line in
source[lineno+1:upper_bound]]
+ lower_bound = max(0, lineno - context_lines)
+ upper_bound = lineno + context_lines
- return lower_bound, pre_context, context_line, post_context
- except (OSError, IOError):
- return None, [], None, []
+ pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
+ context_line = source[lineno].strip('\n')
+ post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]]
+ return lower_bound, pre_context, context_line, post_context
+
#
# Templates are embedded in the file so that we know the error handler will
# always work even if the template loader is broken.
@@ -314,7 +332,7 @@
</tr>
<tr>
<th>Exception Location:</th>
- <td>{{ lastframe.filename }} in {{ lastframe.function }}, line {{
lastframe.lineno }}</td>
+ <td>{{ lastframe.filename|escape }} in {{ lastframe.function|escape }},
line {{ lastframe.lineno }}</td>
</tr>
</table>
</div>
@@ -361,7 +379,7 @@
<ul class="traceback">
{% for frame in frames %}
<li class="frame">
- <code>{{ frame.filename }}</code> in <code>{{ frame.function
}}</code>
+ <code>{{ frame.filename|escape }}</code> in <code>{{
frame.function|escape }}</code>
{% if frame.context_line %}
<div class="context" id="c{{ frame.id }}">
Modified: django/branches/boulder-oracle-sprint/docs/distributions.txt
===================================================================
--- django/branches/boulder-oracle-sprint/docs/distributions.txt
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/docs/distributions.txt
2007-04-23 16:16:27 UTC (rev 5062)
@@ -47,16 +47,18 @@
------
A Django package is available for `Fedora Linux`_, in the "Fedora Extras"
-repository. The `current Fedora package`_ is based on Django 0.95.1, and can be
-installed by typing ``yum install Django``.
+repository. The `current Fedora package`_ is based on Django 0.96, and can be
+installed by typing ``yum install Django``. The previous link is for the i386
+binary. Users of other architectures should be able to use that as a starting
+point to find their preferred version.
.. _Fedora Linux: http://fedora.redhat.com/
-.. _current Fedora package:
http://fedoraproject.org/extras/6/i386/repodata/repoview/Django-0-0.95.1-1.fc6.html
+.. _current Fedora package:
http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386/repoview/Django.html
Gentoo
------
-A Django build is available for `Gentoo Linux`_, and is based on Django 0.95.1.
+A Django build is available for `Gentoo Linux`_, and is based on Django 0.96.
The `current Gentoo build`_ can be installed by typing ``emerge django``.
.. _Gentoo Linux: http://www.gentoo.org/
Modified: django/branches/boulder-oracle-sprint/docs/generic_views.txt
===================================================================
--- django/branches/boulder-oracle-sprint/docs/generic_views.txt
2007-04-23 05:51:29 UTC (rev 5061)
+++ django/branches/boulder-oracle-sprint/docs/generic_views.txt
2007-04-23 16:16:27 UTC (rev 5062)
@@ -44,7 +44,7 @@
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
'archive_day', info_dict),
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
'archive_month', info_dict),
(r'^(?P<year>\d{4})/$',
'archive_year', info_dict),
- (r'^/?$',
'archive_index', info_dict),
+ (r'^$',
'archive_index', info_dict),
)
As you can see, this URLconf defines a few options in ``info_dict``.
Modified:
django/branches/boulder-oracle-sprint/tests/regressiontests/templates/tests.py
===================================================================
---
django/branches/boulder-oracle-sprint/tests/regressiontests/templates/tests.py
2007-04-23 05:51:29 UTC (rev 5061)
+++
django/branches/boulder-oracle-sprint/tests/regressiontests/templates/tests.py
2007-04-23 16:16:27 UTC (rev 5062)
@@ -259,6 +259,7 @@
'filter01': ('{% filter upper %}{% endfilter %}', {}, ''),
'filter02': ('{% filter upper %}django{% endfilter %}', {},
'DJANGO'),
'filter03': ('{% filter upper|lower %}django{% endfilter %}', {},
'django'),
+ 'filter04': ('{% filter cut:remove %}djangospam{% endfilter %}',
{'remove': 'spam'}, 'django'),
### FIRSTOF TAG
###########################################################
'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''),
@@ -654,6 +655,9 @@
'with01': ('{% with dict.key as key %}{{ key }}{% endwith %}',
{'dict': {'key':50}}, '50'),
'with02': ('{{ key }}{% with dict.key as key %}{{ key }}-{{
dict.key }}-{{ key }}{% endwith %}{{ key }}', {'dict': {'key':50}},
('50-50-50', 'INVALID50-50-50INVALID')),
+ 'with-error01': ('{% with dict.key xx key %}{{ key }}{% endwith
%}', {'dict': {'key':50}}, template.TemplateSyntaxError),
+ 'with-error02': ('{% with dict.key as %}{{ key }}{% endwith %}',
{'dict': {'key':50}}, template.TemplateSyntaxError),
+
### NOW TAG
########################################################
# Simple case
'now01' : ('{% now "j n Y"%}', {}, str(datetime.now().day) + ' ' +
str(datetime.now().month) + ' ' + str(datetime.now().year)),
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---