Commits

Anonymous committed 884f702

[multi-db] Merged trunk to [4000]. Some tests still failing.

Comments (0)

Files changed (33)

     Kieran Holland <http://www.kieranholland.com>
     Robert Rock Howard <http://djangomojo.com/>
     Jason Huggins <http://www.jrandolph.com/blog/>
+	Baurzhan Ismagulov <ibr@radix50.net>
     jcrasta@gmail.com
     Michael Josephson <http://www.sdjournal.com/>
     jpellerin@gmail.com

django/conf/__init__.py

         self.SETTINGS_MODULE = settings_module
 
         try:
-            mod = __import__(self.SETTINGS_MODULE, '', '', [''])
+            mod = __import__(self.SETTINGS_MODULE, {}, {}, [''])
         except ImportError, e:
             raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
 
         new_installed_apps = []
         for app in self.INSTALLED_APPS:
             if app.endswith('.*'):
-                appdir = os.path.dirname(__import__(app[:-2], '', '', ['']).__file__)
+                appdir = os.path.dirname(__import__(app[:-2], {}, {}, ['']).__file__)
                 for d in os.listdir(appdir):
                     if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
                         new_installed_apps.append('%s.%s' % (app[:-2], d))

django/conf/locale/pt_BR/LC_MESSAGES/django.mo

Binary file modified.

django/conf/locale/pt_BR/LC_MESSAGES/django.po

 # Copyright (C) 2006 THE PACKAGE'S COPYRIGHT HOLDER
 # This file is distributed under the same license as the PACKAGE package.
 # João Marcus Christ <joaoma@gmail.com>, 2006.
+# Carlos Eduardo de Paula <carlosedp@gmail.com>, 2006.
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: django\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2006-05-16 10:11+0200\n"
-"PO-Revision-Date: 2006-01-23 19:54-0200\n"
-"Last-Translator: João Marcus Christ <joaoma@gmail.com>\n"
+"PO-Revision-Date: 2006-11-01 17:45-0300\n"
+"Last-Translator: Carlos Eduardo de Paula <carlosedp@gmail.com>\n"
 "Language-Team: Português do Brasil <pt-br@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "removed\" message will be displayed instead."
 msgstr ""
 "Selecione esta opção se o comentário é inapropriado. Uma mensagem \"Este "
-"comentário foi removido\" será mostrada no lugar."
+"comentário foi removido\" a mensagem será mostrada no lugar."
 
 #: contrib/comments/models.py:91
 #, fuzzy
 msgid "comments"
-msgstr "comentário"
+msgstr "comentários"
 
 #: contrib/comments/models.py:131 contrib/comments/models.py:207
 msgid "Content object"
 #: contrib/comments/models.py:238
 #, fuzzy
 msgid "karma scores"
-msgstr "Pontuação de Karma"
+msgstr "Pontuações de Karma"
 
 #: contrib/comments/models.py:242
 #, python-format
 
 #: contrib/comments/models.py:265
 msgid "flag date"
-msgstr "marca de data"
+msgstr "flag de data"
 
 #: contrib/comments/models.py:268
 #, fuzzy
 msgid "user flag"
-msgstr "Flag de usuário"
+msgstr "flag de usuário"
 
 #: contrib/comments/models.py:269
 #, fuzzy
 msgid "user flags"
-msgstr "Flags de usuário"
+msgstr "flags de usuário"
 
 #: contrib/comments/models.py:273
 #, python-format
 
 #: contrib/comments/models.py:278
 msgid "deletion date"
-msgstr "data de apagamento"
+msgstr "data de exclusão"
 
 #: contrib/comments/models.py:280
 #, fuzzy
 msgid "moderator deletion"
-msgstr "Apagamento feito por moderador"
+msgstr "Exclusão feita pelo moderador"
 
 #: contrib/comments/models.py:281
 #, fuzzy
 msgid "moderator deletions"
-msgstr "Apagamentos feitos por moderador"
+msgstr "Exclusões feitas pelo moderador"
 
 #: contrib/comments/models.py:285
 #, python-format
 msgid "Moderator deletion by %r"
-msgstr "Apagamento feito pelo moderador %r"
+msgstr "Exclusao feita pelo moderador %r"
 
 #: contrib/comments/views/karma.py:19
 msgid "Anonymous users cannot vote"
 "\n"
 "%(text)s"
 msgstr[0] ""
-"Este comentário foi feito por um usuário esboço:\n"
-"\n"
+"Este comentário foi feito por um usuário que postou menos de %(count)s "
+"comentário:\n"
 "%(text)s"
 msgstr[1] ""
-"Este comentário foi feito por um usuário esboço:\n"
-"\n"
+"Este comentário foi feito por um usuário que postou menos de %(count)s "
+"comentários:\n"
 "%(text)s"
 
 #: contrib/comments/views/comments.py:117
 "\n"
 "%(text)s"
 msgstr ""
-"Este comentário foi feito por um usuário esboço:\n"
+"Este comentário foi feito por um usuário incompleto:\n"
 "\n"
 "%(text)s"
 
 #: contrib/comments/templates/comments/form.html:6
 #, fuzzy
 msgid "Forgotten your password?"
-msgstr "Alterar minha senha"
+msgstr "Esqueceu sua senha?"
 
 #: contrib/comments/templates/comments/form.html:8
 #: contrib/admin/templates/admin/object_history.html:3
 #: contrib/comments/templates/comments/form.html:12
 #, fuzzy
 msgid "Ratings"
-msgstr "avaliação #1"
+msgstr "Avaliações"
 
 #: contrib/comments/templates/comments/form.html:12
 #: contrib/comments/templates/comments/form.html:23
 msgid "Required"
-msgstr ""
+msgstr "Requerido"
 
 #: contrib/comments/templates/comments/form.html:12
 #: contrib/comments/templates/comments/form.html:23
 msgid "Optional"
-msgstr ""
+msgstr "Opcional"
 
 #: contrib/comments/templates/comments/form.html:23
 msgid "Post a photo"
-msgstr ""
+msgstr "Postar uma foto"
 
 #: contrib/comments/templates/comments/form.html:27
 #: contrib/comments/templates/comments/freeform.html:5
 #: contrib/comments/templates/comments/freeform.html:9
 #, fuzzy
 msgid "Preview comment"
-msgstr "Comentário livre"
+msgstr "Pré visualizar comentário"
 
 #: contrib/comments/templates/comments/freeform.html:4
 #, fuzzy
 msgid "Your name:"
-msgstr "usuário"
+msgstr "Seu nome:"
 
 #: contrib/admin/filterspecs.py:40
 #, python-format
 "sensitive."
 msgstr ""
 "Por favor entre usuário e senha corretos. Note que ambos os "
-"camposdiferenciam maiúsculas e minúsculas."
+"campos diferenciam maiúsculas e minúsculas."
 
 #: contrib/admin/views/decorators.py:23
 #: contrib/admin/templates/admin/login.html:25
 
 #: contrib/admin/views/decorators.py:82
 msgid "Usernames cannot contain the '@' character."
-msgstr "Nomes de usuário não podem conter o caracter '@'."
+msgstr "Nomes de usuário não podem conter o caractere '@'."
 
 #: contrib/admin/views/decorators.py:84
 #, python-format
 #: contrib/admin/views/main.py:508
 #, python-format
 msgid "The %(name)s \"%(obj)s\" was deleted successfully."
-msgstr "O(A) %(name)s \"%(obj)s\" foi adicionado com sucesso."
+msgstr "O(A) %(name)s \"%(obj)s\" foi excluído com sucesso."
 
 #: contrib/admin/views/main.py:511
 msgid "Are you sure?"
 "mail and should be fixed shortly. Thanks for your patience."
 msgstr ""
 "Houve um erro. Este foi reportado aos administradores do site através d e-"
-"mail e deve ser consertado em breve. Obrigado pela compreensão."
+"mail e deve ser corrigido em breve. Obrigado pela compreensão."
 
 #: contrib/admin/templates/admin/404.html:4
 #: contrib/admin/templates/admin/404.html:8
 #: contrib/admin/templates/admin/index.html:17
 #, python-format
 msgid "Models available in the %(name)s application."
-msgstr ""
+msgstr "Modelos disponíveis na aplicação %(name)s"
 
 #: contrib/admin/templates/admin/index.html:28
 #: contrib/admin/templates/admin/change_form.html:15
 
 #: contrib/admin/templates/admin/login.html:22
 msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
-msgstr "Você <a href=\"/password_reset/\"esqueceu a senha</a>?"
+msgstr "Você <a href=\"/password_reset/\">esqueceu sua senha</a>?"
 
 #: contrib/admin/templates/admin/base.html:23
 msgid "Welcome,"
 
 #: contrib/admin/templates/admin/search_form.html:8
 msgid "Go"
-msgstr ""
+msgstr "Ir"
 
 #: contrib/admin/templates/admin/change_form.html:21
 msgid "View on site"
 msgid "Please correct the error below."
 msgid_plural "Please correct the errors below."
 msgstr[0] "Por favor, corrija o erro abaixo."
-msgstr[1] "Por favor, corrija o erro abaixo."
+msgstr[1] "Por favor, corrija os erros abaixo."
 
 #: contrib/admin/templates/admin/change_form.html:48
 msgid "Ordering"
 "We've e-mailed a new password to the e-mail address you submitted. You "
 "should be receiving it shortly."
 msgstr ""
-"Nós enviamos uma nova senha para o e-mail que você informou. Você deve estar "
-"recebendo uma mensagem em breve."
+"Nós enviamos uma nova senha para o e-mail que você informou. Você deverá "
+"receber uma mensagem em breve."
 
 #: contrib/admin/templates/registration/password_change_form.html:12
 msgid ""
 
 #: contrib/admin/templates/registration/password_reset_email.html:7
 msgid "Feel free to change this password by going to this page:"
-msgstr "Sinta-se livre para alterar esta senha visitando esta página:"
+msgstr "Sinta-se a vontade para alterar esta senha visitando esta página:"
 
 #: contrib/admin/templates/registration/password_reset_email.html:11
 msgid "Your username, in case you've forgotten:"
 
 #: contrib/admin/templates/admin_doc/bookmarklets.html:25
 msgid "Edit this object (current window)"
-msgstr "Edita este objeto (janela atual)"
+msgstr "Editar este objeto (janela atual)"
 
 #: contrib/admin/templates/admin_doc/bookmarklets.html:26
 msgid "Jumps to the admin page for pages that represent a single object."
 msgstr ""
-"Vai para a página de administração para páginas que representam um objeto "
+"Vai para a página de administração que representam um objeto "
 "único."
 
 #: contrib/admin/templates/admin_doc/bookmarklets.html:28
 msgid "Edit this object (new window)"
-msgstr "Edita este objeto (nova janela)"
+msgstr "Editar este objeto (nova janela)"
 
 #: contrib/admin/templates/admin_doc/bookmarklets.html:29
 msgid "As above, but opens the admin page in a new window."
 
 #: contrib/flatpages/models.py:14
 msgid "registration required"
-msgstr "é obrigatório registrar"
+msgstr "registro obrigatório"
 
 #: contrib/flatpages/models.py:14
 msgid "If this is checked, only logged-in users will be able to view the page."
 #: contrib/auth/models.py:17
 #, fuzzy
 msgid "permission"
-msgstr "Permissão"
+msgstr "permissão"
 
 #: contrib/auth/models.py:18 contrib/auth/models.py:27
 #, fuzzy
 msgid "permissions"
-msgstr "Permissões"
+msgstr "permissões"
 
 #: contrib/auth/models.py:29
 #, fuzzy
 msgid "group"
-msgstr "Grupo"
+msgstr "grupo"
 
 #: contrib/auth/models.py:30 contrib/auth/models.py:65
 #, fuzzy
 msgid "groups"
-msgstr "Grupos"
+msgstr "grupos"
 
 #: contrib/auth/models.py:55
 msgid "username"
 #: contrib/auth/models.py:67
 #, fuzzy
 msgid "user permissions"
-msgstr "Permissões"
+msgstr "permissões do usuário"
 
 #: contrib/auth/models.py:70
 #, fuzzy
 msgid "user"
-msgstr "Usuário"
+msgstr "usuário"
 
 #: contrib/auth/models.py:71
 #, fuzzy
 msgid "users"
-msgstr "Usuários"
+msgstr "usuários"
 
 #: contrib/auth/models.py:76
 msgid "Personal info"
 #: contrib/auth/models.py:219
 #, fuzzy
 msgid "message"
-msgstr "Mensagem"
+msgstr "mensagem"
 
 #: contrib/auth/forms.py:30
 msgid ""
 "required for logging in."
 msgstr ""
 "Seu navegador Web não parece estar com os cookies habilitados. Cookies são "
-"requeridos para acesssar."
+"requeridos para acessar."
 
 #: contrib/contenttypes/models.py:25
 #, fuzzy
 #: utils/dates.py:19
 #, fuzzy
 msgid "jan"
-msgstr "e"
+msgstr "jan"
 
 #: utils/dates.py:19
 msgid "feb"
-msgstr ""
+msgstr "fev"
 
 #: utils/dates.py:19
 msgid "mar"
-msgstr ""
+msgstr "mar"
 
 #: utils/dates.py:19
 msgid "apr"
-msgstr ""
+msgstr "abr"
 
 #: utils/dates.py:19
 #, fuzzy
 msgid "may"
-msgstr "dia"
+msgstr "mai"
 
 #: utils/dates.py:19
 msgid "jun"
-msgstr ""
+msgstr "jun"
 
 #: utils/dates.py:20
 msgid "jul"
-msgstr ""
+msgstr "jul"
 
 #: utils/dates.py:20
 msgid "aug"
-msgstr ""
+msgstr "ago"
 
 #: utils/dates.py:20
 msgid "sep"
-msgstr ""
+msgstr "set"
 
 #: utils/dates.py:20
 msgid "oct"
-msgstr ""
+msgstr "out"
 
 #: utils/dates.py:20
 msgid "nov"
-msgstr ""
+msgstr "nov"
 
 #: utils/dates.py:20
 msgid "dec"
-msgstr ""
+msgstr "dez"
 
 #: utils/dates.py:27
 msgid "Jan."
 msgid "year"
 msgid_plural "years"
 msgstr[0] "ano"
-msgstr[1] "ano"
+msgstr[1] "anos"
 
 #: utils/timesince.py:13
 #, fuzzy
 msgid "month"
 msgid_plural "months"
 msgstr[0] "mês"
-msgstr[1] "mês"
+msgstr[1] "meses"
 
 #: utils/timesince.py:14
 msgid "week"
 msgid_plural "weeks"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "semana"
+msgstr[1] "semanas"
 
 #: utils/timesince.py:15
 #, fuzzy
 msgid "day"
 msgid_plural "days"
 msgstr[0] "dia"
-msgstr[1] "dia"
+msgstr[1] "dias"
 
 #: utils/timesince.py:16
 #, fuzzy
 msgid "hour"
 msgid_plural "hours"
 msgstr[0] "hora"
-msgstr[1] "hora"
+msgstr[1] "horas"
 
 #: utils/timesince.py:17
 #, fuzzy
 msgid "minute"
 msgid_plural "minutes"
 msgstr[0] "minuto"
-msgstr[1] "minuto"
+msgstr[1] "minutos"
 
 #: conf/global_settings.py:37
 msgid "Bengali"
-msgstr ""
+msgstr "Bengalês"
 
 #: conf/global_settings.py:38
 msgid "Czech"
 #: conf/global_settings.py:40
 #, fuzzy
 msgid "Danish"
-msgstr "Espanhol"
+msgstr "Dinamarquês"
 
 #: conf/global_settings.py:41
 msgid "German"
 
 #: conf/global_settings.py:42
 msgid "Greek"
-msgstr ""
+msgstr "Grego"
 
 #: conf/global_settings.py:43
 msgid "English"
 
 #: conf/global_settings.py:47
 msgid "Hungarian"
-msgstr ""
+msgstr "Húngaro"
 
 #: conf/global_settings.py:48
 msgid "Hebrew"
-msgstr ""
+msgstr "Hebraico"
 
 #: conf/global_settings.py:49
 msgid "Icelandic"
 
 #: conf/global_settings.py:54
 msgid "Brazilian"
-msgstr "Brazileiro"
+msgstr "Brasileiro"
 
 #: conf/global_settings.py:55
 msgid "Romanian"
 #: conf/global_settings.py:58
 #, fuzzy
 msgid "Slovenian"
-msgstr "Eslovaco"
+msgstr "Esloveno"
 
 #: conf/global_settings.py:59
 msgid "Serbian"
 #: conf/global_settings.py:61
 #, fuzzy
 msgid "Ukrainian"
-msgstr "Brazileiro"
+msgstr "Ucraniano"
 
 #: conf/global_settings.py:62
 msgid "Simplified Chinese"
 
 #: core/validators.py:116
 msgid "Enter a whole number."
-msgstr "Informe um número inteiro."
+msgstr "Informe um número completo."
 
 #: core/validators.py:120
 msgid "Only alphabetical characters are allowed here."
 msgid "Watch your mouth! The word %s is not allowed here."
 msgid_plural "Watch your mouth! The words %s are not allowed here."
 msgstr[0] "Lave sua boca! A palavra %s não é permitida aqui."
-msgstr[1] "Lave sua boca! A palavra %s não é permitida aqui."
+msgstr[1] "Lave sua boca! As palavras %s não são permitidas aqui."
 
 #: core/validators.py:236
 #, python-format
 
 #: core/validators.py:347
 msgid "Please enter a valid decimal number."
-msgstr "Informe um número decimal."
+msgstr "Informe um número decimal válido."
 
 #: core/validators.py:349
 #, fuzzy, python-format
 msgid "Please enter a valid decimal number with at most %s total digit."
 msgid_plural ""
 "Please enter a valid decimal number with at most %s total digits."
-msgstr[0] "Por favor entre com um número decimal com no máximo %s digitos."
+msgstr[0] "Por favor entre com um número decimal com no máximo %s digito."
 msgstr[1] "Por favor entre com um número decimal com no máximo %s digitos."
 
 #: core/validators.py:352
 msgid_plural ""
 "Please enter a valid decimal number with at most %s decimal places."
 msgstr[0] "Informe um número decimal com no máximo %s casa decimal."
-msgstr[1] "Informe um número decimal com no máximo %s casa decimal."
+msgstr[1] "Informe um número decimal com no máximo %s casas decimais."
 
 #: core/validators.py:362
 #, python-format
 #: db/models/fields/__init__.py:337
 #, fuzzy
 msgid "This value must be an integer."
-msgstr "Este valor deve ser uma potência de %s."
+msgstr "Este valor deve ser um inteiro."
 
 #: db/models/fields/__init__.py:369
 #, fuzzy
 msgid "This value must be either True or False."
-msgstr "Este valor deve ser uma potência de %s."
+msgstr "Este valor deve ser Verdadeiro ou Falso."
 
 #: db/models/fields/__init__.py:385
 #, fuzzy
 msgid "This field cannot be null."
-msgstr "Este campo é inválido."
+msgstr "Este campo não pode ser nulo."
 
 #: db/models/fields/__init__.py:562
 msgid "Enter a valid filename."
 #: db/models/fields/related.py:579
 #, fuzzy
 msgid "Separate multiple IDs with commas."
-msgstr " Separe IDs múltiplos com vírgulas."
+msgstr "Separe IDs múltiplos com vírgulas."
 
 #: db/models/fields/related.py:581
 #, fuzzy
 msgid ""
 "Hold down \"Control\", or \"Command\" on a Mac, to select more than one."
 msgstr ""
-" Mantenha pressionado \"Control\", ou \"Command\" num Mac para selecionar "
+" Mantenha pressionado \"Control\", ou \"Command\" no Mac para selecionar "
 "mais de uma opção."
 
 #: db/models/fields/related.py:625
 msgstr[0] ""
 "Por favor, entre IDs válidos para %(self)s. O valor %(value)r é inválido."
 msgstr[1] ""
-"Por favor, entre IDs válidos para %(self)s. O valor %(value)r é inválido."
+"Por favor, entre IDs válidos para %(self)s. Os valores %(value)r são inválidos."
 
 #: forms/__init__.py:380
 #, fuzzy, python-format
 msgid "Ensure your text is less than %s character."
 msgid_plural "Ensure your text is less than %s characters."
-msgstr[0] "Certifique-se de que seu texto tenha menos que %s caracteres."
+msgstr[0] "Certifique-se de que seu texto tenha menos que %s caractere."
 msgstr[1] "Certifique-se de que seu texto tenha menos que %s caracteres."
 
 #: forms/__init__.py:385
 msgid "Line breaks are not allowed here."
-msgstr "Não são permitidas múltiplas linhas aqui."
+msgstr "Não são permitidas quebras de linha aqui."
 
 #: forms/__init__.py:480 forms/__init__.py:551 forms/__init__.py:589
 #, python-format
 #~ "\n"
 #~ "%(text)s"
 #~ msgstr ""
-#~ "Este comentário foi envidao por um usuário que enviou menos de %(count)s "
+#~ "Este comentário foi enviado por um usuário que enviou menos de %(count)s "
 #~ "comentário:\n"
 #~ "\n"
 #~ "%(text)sEste comentário foi enviado por um usuário que enviou menos de %"
 
 #, fuzzy
 #~ msgid "count"
-#~ msgstr "conteúdo"
+#~ msgstr "contagem"

django/conf/locale/pt_BR/LC_MESSAGES/djangojs.mo

Binary file modified.

django/conf/locale/pt_BR/LC_MESSAGES/djangojs.po

-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# Português do Brasil translation of django.
+# Copyright (C) 2006 THE PACKAGE'S COPYRIGHT HOLDER
 # This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+# Carlos Eduardo de Paula <carlosedp@gmail.com>, 2006.
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: django\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2005-12-09 11:51+0100\n"
-"PO-Revision-Date: 2006-01-23 19:54-0200\n"
-"Last-Translator: João Marcus Christ <joaoma@gmail.com>\n"
+"PO-Revision-Date: 2006-11-01 17:45-0300\n"
+"Last-Translator: Carlos Eduardo de Paula <carlosedp@gmail.com>\n"
 "Language-Team: Português do Brasil <pt-br@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "January February March April May June July August September October November "
 "December"
 msgstr ""
-"Janeiro Fevereiro Março Abrio Maio Junho Julho Agosto Setembro Outubro Novembro "
+"Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro "
 "Dezembro"
 #: contrib/admin/media/js/dateparse.js:27
 msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"

django/contrib/admin/views/doc.py

         return missing_docutils_page(request)
 
     if settings.ADMIN_FOR:
-        settings_modules = [__import__(m, '', '', ['']) for m in settings.ADMIN_FOR]
+        settings_modules = [__import__(m, {}, {}, ['']) for m in settings.ADMIN_FOR]
     else:
         settings_modules = [settings]
 
     views = []
     for settings_mod in settings_modules:
-        urlconf = __import__(settings_mod.ROOT_URLCONF, '', '', [''])
+        urlconf = __import__(settings_mod.ROOT_URLCONF, {}, {}, [''])
         view_functions = extract_views_from_urlpatterns(urlconf.urlpatterns)
         if Site._meta.installed:
             site_obj = Site.objects.get(pk=settings_mod.SITE_ID)
 
     mod, func = urlresolvers.get_mod_func(view)
     try:
-        view_func = getattr(__import__(mod, '', '', ['']), func)
+        view_func = getattr(__import__(mod, {}, {}, ['']), func)
     except (ImportError, AttributeError):
         raise Http404
     title, body, metadata = utils.parse_docstring(view_func.__doc__)
 def template_detail(request, template):
     templates = []
     for site_settings_module in settings.ADMIN_FOR:
-        settings_mod = __import__(site_settings_module, '', '', [''])
+        settings_mod = __import__(site_settings_module, {}, {}, [''])
         if Site._meta.installed:
             site_obj = Site.objects.get(pk=settings_mod.SITE_ID)
         else:

django/contrib/admin/views/template.py

     # get a dict of {site_id : settings_module} for the validator
     settings_modules = {}
     for mod in settings.ADMIN_FOR:
-        settings_module = __import__(mod, '', '', [''])
+        settings_module = __import__(mod, {}, {}, [''])
         settings_modules[settings_module.SITE_ID] = settings_module
     manipulator = TemplateValidator(settings_modules)
     new_data, errors = {}, {}

django/contrib/auth/__init__.py

     i = path.rfind('.')
     module, attr = path[:i], path[i+1:]
     try:
-        mod = __import__(module, '', '', [attr])
+        mod = __import__(module, {}, {}, [attr])
     except ImportError, e:
         raise ImproperlyConfigured, 'Error importing authentication backend %s: "%s"' % (module, e)
     try:

django/core/cache/__init__.py

     if host.endswith('/'):
         host = host[:-1]
 
-    cache_class = getattr(__import__('django.core.cache.backends.%s' % BACKENDS[scheme], '', '', ['']), 'CacheClass')
+    cache_class = getattr(__import__('django.core.cache.backends.%s' % BACKENDS[scheme], {}, {}, ['']), 'CacheClass')
     return cache_class(host, params)
 
 cache = get_cache(settings.CACHE_BACKEND)

django/core/handlers/base.py

                 raise exceptions.ImproperlyConfigured, '%s isn\'t a middleware module' % middleware_path
             mw_module, mw_classname = middleware_path[:dot], middleware_path[dot+1:]
             try:
-                mod = __import__(mw_module, '', '', [''])
+                mod = __import__(mw_module, {}, {}, [''])
             except ImportError, e:
                 raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
             try:

django/core/management.py

         # Import the 'management' module within each installed app, to register
         # dispatcher events.
         try:
-            __import__(app_name + '.management', '', '', [''])
+            __import__(app_name + '.management', {}, {}, [''])
         except ImportError:
             pass
 
         test_module_name = '.'.join(test_path[:-1])
     else:
         test_module_name = '.'
-    test_module = __import__(test_module_name, [],[],test_path[-1])
+    test_module = __import__(test_module_name, {}, {}, test_path[-1])
     test_runner = getattr(test_module, test_path[-1])
 
     test_runner(app_list, verbosity)
     project_directory = os.path.dirname(settings_mod.__file__)
     project_name = os.path.basename(project_directory)
     sys.path.append(os.path.join(project_directory, '..'))
-    project_module = __import__(project_name, '', '', [''])
+    project_module = __import__(project_name, {}, {}, [''])
     sys.path.pop()
 
     # Set DJANGO_SETTINGS_MODULE appropriately.

django/core/serializers/__init__.py

         
 def register_serializer(format, serializer_module):
     """Register a new serializer by passing in a module name."""
-    module = __import__(serializer_module, '', '', [''])
+    module = __import__(serializer_module, {}, {}, [''])
     _serializers[format] = module
     
 def unregister_serializer(format):

django/core/servers/fastcgi.py

   port=PORTNUM         port to listen on.
   socket=FILE          UNIX socket to listen on.
   method=IMPL          prefork or threaded (default prefork)
+  maxrequests=NUMBER   number of requests a child handles before it is 
+                       killed and a new child is forked (0 = no limit).
   maxspare=NUMBER      max number of spare processes to keep running.
   minspare=NUMBER      min number of spare processes to prefork.
   maxchildren=NUMBER   hard limit number of processes in prefork mode.
     'maxspare': 5,
     'minspare': 2,
     'maxchildren': 50,
+    'maxrequests': 0,
 }
 
 def fastcgi_help(message=None):
             'maxSpare': int(options["maxspare"]),
             'minSpare': int(options["minspare"]),
             'maxChildren': int(options["maxchildren"]),
+            'maxRequests': int(options["maxrequests"]), 
         }
     elif options['method'] in ('thread', 'threaded'):
         from flup.server.fcgi import WSGIServer

django/core/urlresolvers.py

             return self._callback
         mod_name, func_name = get_mod_func(self._callback_str)
         try:
-            self._callback = getattr(__import__(mod_name, '', '', ['']), func_name)
+            self._callback = getattr(__import__(mod_name, {}, {}, ['']), func_name)
         except ImportError, e:
             raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e))
         except AttributeError, e:
     def reverse(self, viewname, *args, **kwargs):
         mod_name, func_name = get_mod_func(viewname)
         try:
-            lookup_view = getattr(__import__(mod_name, '', '', ['']), func_name)
+            lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
         except (ImportError, AttributeError):
             raise NoReverseMatch
         if lookup_view != self.callback:
             return self._urlconf_module
         except AttributeError:
             try:
-                self._urlconf_module = __import__(self.urlconf_name, '', '', [''])
+                self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
             except ValueError, e:
                 # Invalid urlconf_name, such as "foo.bar." (note trailing period)
                 raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e)
         callback = getattr(self.urlconf_module, 'handler%s' % view_type)
         mod_name, func_name = get_mod_func(callback)
         try:
-            return getattr(__import__(mod_name, '', '', ['']), func_name), {}
+            return getattr(__import__(mod_name, {}, {}, ['']), func_name), {}
         except (ImportError, AttributeError), e:
             raise ViewDoesNotExist, "Tried %s. Error was: %s" % (callback, str(e))
 
         if not callable(lookup_view):
             mod_name, func_name = get_mod_func(lookup_view)
             try:
-                lookup_view = getattr(__import__(mod_name, '', '', ['']), func_name)
+                lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
             except (ImportError, AttributeError):
                 raise NoReverseMatch
         for pattern in self.urlconf_module.urlpatterns:

django/db/__init__.py

 
     def get_introspection_module(self):
         return __import__('django.db.backends.%s.introspection' % 
-                          self.settings.DATABASE_ENGINE, '', '', [''])
+                          self.settings.DATABASE_ENGINE, {}, {}, [''])
 
     def get_creation_module(self):
         return __import__('django.db.backends.%s.creation' % 
-                          self.settings.DATABASE_ENGINE, '', '', [''])
+                          self.settings.DATABASE_ENGINE, {}, {}, [''])
 
     def load_backend(self):
         try:
             backend = __import__('django.db.backends.%s.base' %
-                                 self.settings.DATABASE_ENGINE, '', '', [''])
+                                 self.settings.DATABASE_ENGINE, {}, {}, [''])
         except ImportError, e:
             # The database backend wasn't found. Display a helpful error
             # message listing all possible database backends.
 
     def runshell(self):
         __import__('django.db.backends.%s.client' %
-                   self.settings.DATABASE_ENGINE, '', '', ['']
+                   self.settings.DATABASE_ENGINE, {}, {}, ['']
                    ).runshell(self.settings)
         
     def reset_queries(self):

django/db/models/base.py

             setattr(self, cachename, get_image_dimensions(filename))
         return getattr(self, cachename)
 
-    # Handles setting many-to-many related objects.
-    # Example: Album.set_songs()
-    def _set_related_many_to_many(self, rel_class, rel_field, id_list):
-        id_list = map(int, id_list) # normalize to integers
-        rel = rel_field.rel.to
-        m2m_table = rel_field.m2m_db_table()
-        this_id = self._get_pk_val()
-        db = self._default_manager.db
-        connection = db.connection
-        qn = db.backend.quote_name
-        cursor = connection.cursor()
-        cursor.execute("DELETE FROM %s WHERE %s = %%s" % \
-            (qn(m2m_table),
-            qn(rel_field.m2m_column_name())), [this_id])
-        sql = "INSERT INTO %s (%s, %s) VALUES (%%s, %%s)" % \
-            (qn(m2m_table),
-            qn(rel_field.m2m_column_name()),
-            qn(rel_field.m2m_reverse_name()))
-        cursor.executemany(sql, [(this_id, i) for i in id_list])
-        transaction.commit_unless_managed([connection])
-
 ############################################
 # HELPER FUNCTIONS (CURRIED MODEL METHODS) #
 ############################################

django/db/models/fields/__init__.py

 
     def get_db_prep_save(self, value):
         # Casts dates into string format for entry into database.
-        if value is not None:
+        if isinstance(value, datetime.datetime):
+            value = value.date().strftime('%Y-%m-%d')
+        elif isinstance(value, datetime.date):
             value = value.strftime('%Y-%m-%d')
         return Field.get_db_prep_save(self, value)
 
 
     def pre_save(self, model_instance, add):
         value = super(DateField, self).pre_save(model_instance, add)
-        if value is not None:
+        if isinstance(value, datetime.datetime):
             # MySQL will throw a warning if microseconds are given, because it
             # doesn't support microseconds.
             settings = model_instance._default_manager.db.connection.settings
         # Casts dates into string format for entry into database.
         if value is not None:
             value = str(value)
+        elif isinstance(value, datetime.date):
+            # MySQL will throw a warning if microseconds are given, because it
+            # doesn't support microseconds.
+            if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'):
+                value = datetime.datetime(value.year, value.month, value.day, microsecond=0)
+            value = str(value)
+            
         return Field.get_db_prep_save(self, value)
 
     def get_db_prep_lookup(self, lookup_type, value):

django/db/models/loading.py

 def load_app(app_name):
     "Loads the app with the provided fully qualified name, and returns the model module."
     global _app_list
-    mod = __import__(app_name, '', '', ['models'])
+    mod = __import__(app_name, {}, {}, ['models'])
     if not hasattr(mod, 'models'):
         return None
     if mod.models not in _app_list:

django/newforms/__init__.py

 Django validation and HTML form handling.
 
 TODO:
-    Validation not tied to a particular field
-    <select> and validation of lists
     Default value for field
     Field labels
     Nestable Forms
     "This form field requires foo.js" and form.js_includes()
 """
 
+from util import ValidationError
 from widgets import *
 from fields import *
 from forms import Form

django/newforms/fields.py

 """
 
 from util import ValidationError, DEFAULT_ENCODING
-from widgets import TextInput, CheckboxInput
+from widgets import TextInput, CheckboxInput, Select, SelectMultiple
 import datetime
 import re
 import time
     'Field', 'CharField', 'IntegerField',
     'DEFAULT_DATE_INPUT_FORMATS', 'DateField',
     'DEFAULT_DATETIME_INPUT_FORMATS', 'DateTimeField',
-    'RegexField', 'EmailField', 'BooleanField',
+    'RegexField', 'EmailField', 'URLField', 'BooleanField',
+    'ChoiceField', 'MultipleChoiceField',
+    'ComboField',
 )
 
 # These values, if given to to_python(), will trigger the self.required check.
 EMPTY_VALUES = (None, '')
 
+try:
+    set # Only available in Python 2.4+
+except NameError:
+    from sets import Set as set # Python 2.3 fallback
+
 class Field(object):
     widget = TextInput # Default widget to use when rendering this type of Field.
 
             widget = widget()
         self.widget = widget
 
-    def to_python(self, value):
+    def clean(self, value):
         """
-        Validates the given value and returns its "normalized" value as an
+        Validates the given value and returns its "cleaned" value as an
         appropriate Python object.
 
         Raises ValidationError for any errors.
         Field.__init__(self, required, widget)
         self.max_length, self.min_length = max_length, min_length
 
-    def to_python(self, value):
+    def clean(self, value):
         "Validates max_length and min_length. Returns a Unicode object."
-        Field.to_python(self, value)
+        Field.clean(self, value)
         if value in EMPTY_VALUES: value = u''
         if not isinstance(value, basestring):
             value = unicode(str(value), DEFAULT_ENCODING)
         return value
 
 class IntegerField(Field):
-    def to_python(self, value):
+    def clean(self, value):
         """
         Validates that int() can be called on the input. Returns the result
         of int().
         """
-        super(IntegerField, self).to_python(value)
+        super(IntegerField, self).clean(value)
         try:
             return int(value)
         except (ValueError, TypeError):
         Field.__init__(self, required, widget)
         self.input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
 
-    def to_python(self, value):
+    def clean(self, value):
         """
         Validates that the input can be converted to a date. Returns a Python
         datetime.date object.
         """
-        Field.to_python(self, value)
+        Field.clean(self, value)
         if value in EMPTY_VALUES:
             return None
         if isinstance(value, datetime.datetime):
         Field.__init__(self, required, widget)
         self.input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
 
-    def to_python(self, value):
+    def clean(self, value):
         """
         Validates that the input can be converted to a datetime. Returns a
         Python datetime.datetime object.
         """
-        Field.to_python(self, value)
+        Field.clean(self, value)
         if value in EMPTY_VALUES:
             return None
         if isinstance(value, datetime.datetime):
         self.regex = regex
         self.error_message = error_message or u'Enter a valid value.'
 
-    def to_python(self, value):
+    def clean(self, value):
         """
         Validates that the input matches the regular expression. Returns a
         Unicode object.
         """
-        Field.to_python(self, value)
+        Field.clean(self, value)
         if value in EMPTY_VALUES: value = u''
         if not isinstance(value, basestring):
             value = unicode(str(value), DEFAULT_ENCODING)
     def __init__(self, required=True, widget=None):
         RegexField.__init__(self, email_re, u'Enter a valid e-mail address.', required, widget)
 
+url_re = re.compile(
+    r'^https?://' # http:// or https://
+    r'(?:[A-Z0-9-]+\.)+[A-Z]{2,6}' # domain
+    r'(?::\d+)?' # optional port
+    r'(?:/?|/\S+)$', re.IGNORECASE)
+
+class URLField(RegexField):
+    def __init__(self, required=True, verify_exists=False, widget=None):
+        RegexField.__init__(self, url_re, u'Enter a valid URL.', required, widget)
+        self.verify_exists = verify_exists
+
+    def clean(self, value):
+        value = RegexField.clean(self, value)
+        if self.verify_exists:
+            import urllib2
+            try:
+                u = urllib2.urlopen(value)
+            except ValueError:
+                raise ValidationError(u'Enter a valid URL.')
+            except: # urllib2.URLError, httplib.InvalidURL, etc.
+                raise ValidationError(u'This URL appears to be a broken link.')
+        return value
+
 class BooleanField(Field):
     widget = CheckboxInput
 
-    def to_python(self, value):
+    def clean(self, value):
         "Returns a Python boolean object."
-        Field.to_python(self, value)
+        Field.clean(self, value)
         return bool(value)
+
+class ChoiceField(Field):
+    def __init__(self, choices=(), required=True, widget=Select):
+        if isinstance(widget, type):
+            widget = widget(choices=choices)
+        Field.__init__(self, required, widget)
+        self.choices = choices
+
+    def clean(self, value):
+        """
+        Validates that the input is in self.choices.
+        """
+        value = Field.clean(self, value)
+        if value in EMPTY_VALUES: value = u''
+        if not isinstance(value, basestring):
+            value = unicode(str(value), DEFAULT_ENCODING)
+        elif not isinstance(value, unicode):
+            value = unicode(value, DEFAULT_ENCODING)
+        valid_values = set([str(k) for k, v in self.choices])
+        if value not in valid_values:
+            raise ValidationError(u'Select a valid choice. %s is not one of the available choices.' % value)
+        return value
+
+class MultipleChoiceField(ChoiceField):
+    def __init__(self, choices=(), required=True, widget=SelectMultiple):
+        ChoiceField.__init__(self, choices, required, widget)
+
+    def clean(self, value):
+        """
+        Validates that the input is a list or tuple.
+        """
+        if not isinstance(value, (list, tuple)):
+            raise ValidationError(u'Enter a list of values.')
+        if self.required and not value:
+            raise ValidationError(u'This field is required.')
+        new_value = []
+        for val in value:
+            if not isinstance(val, basestring):
+                value = unicode(str(val), DEFAULT_ENCODING)
+            elif not isinstance(val, unicode):
+                value = unicode(val, DEFAULT_ENCODING)
+            new_value.append(value)
+        # Validate that each value in the value list is in self.choices.
+        valid_values = set([k for k, v in self.choices])
+        for val in new_value:
+            if val not in valid_values:
+                raise ValidationError(u'Select a valid choice. %s is not one of the available choices.' % val)
+        return new_value
+
+class ComboField(Field):
+    def __init__(self, fields=(), required=True, widget=None):
+        Field.__init__(self, required, widget)
+        self.fields = fields
+
+    def clean(self, value):
+        """
+        Validates the given value against all of self.fields, which is a
+        list of Field instances.
+        """
+        Field.clean(self, value)
+        for field in self.fields:
+            value = field.clean(value)
+        return value

django/newforms/forms.py

 from widgets import TextInput, Textarea
 from util import ErrorDict, ErrorList, ValidationError
 
+NON_FIELD_ERRORS = '__all__'
+
+def pretty_name(name):
+    "Converts 'first_name' to 'First name'"
+    name = name[0].upper() + name[1:]
+    return name.replace('_', ' ')
+
 class DeclarativeFieldsMetaclass(type):
     "Metaclass that converts Field attributes to a dictionary called 'fields'."
     def __new__(cls, name, bases, attrs):
 
     def __init__(self, data=None): # TODO: prefix stuff
         self.data = data or {}
-        self.__data_python = None # Stores the data after to_python() has been called.
-        self.__errors = None # Stores the errors after to_python() has been called.
+        self.clean_data = None # Stores the data after clean() has been called.
+        self.__errors = None # Stores the errors after clean() has been called.
+
+    def __str__(self):
+        return self.as_table()
 
     def __iter__(self):
         for name, field in self.fields.items():
             yield BoundField(self, field, name)
 
-    def to_python(self):
+    def __getitem__(self, name):
+        "Returns a BoundField with the given name."
+        try:
+            field = self.fields[name]
+        except KeyError:
+            raise KeyError('Key %r not found in Form' % name)
+        return BoundField(self, field, name)
+
+    def clean(self):
         if self.__errors is None:
-            self._validate()
-        return self.__data_python
+            self.full_clean()
+        return self.clean_data
 
     def errors(self):
         "Returns an ErrorDict for self.data"
         if self.__errors is None:
-            self._validate()
+            self.full_clean()
         return self.__errors
 
     def is_valid(self):
         """
         return not bool(self.errors())
 
-    def __getitem__(self, name):
-        "Returns a BoundField with the given name."
-        try:
-            field = self.fields[name]
-        except KeyError:
-            raise KeyError('Key %r not found in Form' % name)
-        return BoundField(self, field, name)
+    def as_table(self):
+        "Returns this form rendered as an HTML <table>."
+        output = u'\n'.join(['<tr><td>%s:</td><td>%s</td></tr>' % (pretty_name(name), BoundField(self, field, name)) for name, field in self.fields.items()])
+        return '<table>\n%s\n</table>' % output
 
-    def _validate(self):
-        data_python = {}
+    def as_ul(self):
+        "Returns this form rendered as an HTML <ul>."
+        output = u'\n'.join(['<li>%s: %s</li>' % (pretty_name(name), BoundField(self, field, name)) for name, field in self.fields.items()])
+        return '<ul>\n%s\n</ul>' % output
+
+    def as_table_with_errors(self):
+        "Returns this form rendered as an HTML <table>, with errors."
+        output = []
+        if self.errors().get(NON_FIELD_ERRORS):
+            # Errors not corresponding to a particular field are displayed at the top.
+            output.append('<tr><td colspan="2"><ul>%s</ul></td></tr>' % '\n'.join(['<li>%s</li>' % e for e in self.errors()[NON_FIELD_ERRORS]]))
+        for name, field in self.fields.items():
+            bf = BoundField(self, field, name)
+            if bf.errors:
+                output.append('<tr><td colspan="2"><ul>%s</ul></td></tr>' % '\n'.join(['<li>%s</li>' % e for e in bf.errors]))
+            output.append('<tr><td>%s:</td><td>%s</td></tr>' % (pretty_name(name), bf))
+        return '<table>\n%s\n</table>' % '\n'.join(output)
+
+    def as_ul_with_errors(self):
+        "Returns this form rendered as an HTML <ul>, with errors."
+        output = []
+        if self.errors().get(NON_FIELD_ERRORS):
+            # Errors not corresponding to a particular field are displayed at the top.
+            output.append('<li><ul>%s</ul></li>' % '\n'.join(['<li>%s</li>' % e for e in self.errors()[NON_FIELD_ERRORS]]))
+        for name, field in self.fields.items():
+            bf = BoundField(self, field, name)
+            line = '<li>'
+            if bf.errors:
+                line += '<ul>%s</ul>' % '\n'.join(['<li>%s</li>' % e for e in bf.errors])
+            line += '%s: %s</li>' % (pretty_name(name), bf)
+            output.append(line)
+        return '<ul>\n%s\n</ul>' % '\n'.join(output)
+
+    def full_clean(self):
+        """
+        Cleans all of self.data and populates self.__errors and self.clean_data.
+        """
+        self.clean_data = {}
         errors = ErrorDict()
         for name, field in self.fields.items():
+            value = self.data.get(name, None)
             try:
-                value = field.to_python(self.data.get(name, None))
-                data_python[name] = value
+                value = field.clean(value)
+                self.clean_data[name] = value
+                if hasattr(self, 'clean_%s' % name):
+                    value = getattr(self, 'clean_%s' % name)()
+                self.clean_data[name] = value
             except ValidationError, e:
                 errors[name] = e.messages
-        if not errors: # Only set self.data_python if there weren't errors.
-            self.__data_python = data_python
+        try:
+            self.clean_data = self.clean()
+        except ValidationError, e:
+            errors[NON_FIELD_ERRORS] = e.messages
+        if errors:
+            self.clean_data = None
         self.__errors = errors
 
+    def clean(self):
+        """
+        Hook for doing any extra form-wide cleaning after Field.clean() been
+        called on every field.
+        """
+        return self.clean_data
+
 class BoundField(object):
     "A Field plus data"
     def __init__(self, form, field, name):

django/newforms/widgets.py

 HTML Widget classes
 """
 
-__all__ = ('Widget', 'TextInput', 'Textarea', 'CheckboxInput')
+__all__ = (
+    'Widget', 'TextInput', 'PasswordInput', 'HiddenInput', 'FileInput',
+    'Textarea', 'CheckboxInput',
+    'Select', 'SelectMultiple',
+)
 
 from django.utils.html import escape
+from itertools import chain
+
+try:
+    set # Only available in Python 2.4+
+except NameError:
+    from sets import Set as set # Python 2.3 fallback
 
 # Converts a dictionary to a single string with key="value", XML-style.
 # Assumes keys do not need to be XML-escaped.
 flatatt = lambda attrs: ' '.join(['%s="%s"' % (k, escape(v)) for k, v in attrs.items()])
 
 class Widget(object):
+    requires_data_list = False # Determines whether render()'s 'value' argument should be a list.
     def __init__(self, attrs=None):
         self.attrs = attrs or {}
 
     def render(self, name, value):
         raise NotImplementedError
 
-class TextInput(Widget):
+class Input(Widget):
+    "Base class for all <input> widgets (except type='checkbox', which is special)"
+    input_type = None # Subclasses must define this.
     def render(self, name, value, attrs=None):
         if value is None: value = ''
-        final_attrs = dict(self.attrs, type='text', name=name)
+        final_attrs = dict(self.attrs, type=self.input_type, name=name)
         if attrs:
             final_attrs.update(attrs)
         if value != '': final_attrs['value'] = value # Only add the 'value' attribute if a value is non-empty.
         return u'<input %s />' % flatatt(final_attrs)
 
+class TextInput(Input):
+    input_type = 'text'
+
+class PasswordInput(Input):
+    input_type = 'password'
+
+class HiddenInput(Input):
+    input_type = 'hidden'
+
+class FileInput(Input):
+    input_type = 'file'
+
 class Textarea(Widget):
     def render(self, name, value, attrs=None):
         if value is None: value = ''
             final_attrs.update(attrs)
         if value: final_attrs['checked'] = 'checked'
         return u'<input %s />' % flatatt(final_attrs)
+
+class Select(Widget):
+    def __init__(self, attrs=None, choices=()):
+        # choices can be any iterable
+        self.attrs = attrs or {}
+        self.choices = choices
+
+    def render(self, name, value, attrs=None, choices=()):
+        if value is None: value = ''
+        final_attrs = dict(self.attrs, name=name)
+        if attrs:
+            final_attrs.update(attrs)
+        output = [u'<select %s>' % flatatt(final_attrs)]
+        str_value = str(value) # Normalize to string.
+        for option_value, option_label in chain(self.choices, choices):
+            selected_html = (str(option_value) == str_value) and ' selected="selected"' or ''
+            output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(option_label)))
+        output.append(u'</select>')
+        return u'\n'.join(output)
+
+class SelectMultiple(Widget):
+    requires_data_list = True
+    def __init__(self, attrs=None, choices=()):
+        # choices can be any iterable
+        self.attrs = attrs or {}
+        self.choices = choices
+
+    def render(self, name, value, attrs=None, choices=()):
+        if value is None: value = []
+        final_attrs = dict(self.attrs, name=name)
+        if attrs:
+            final_attrs.update(attrs)
+        output = [u'<select multiple="multiple" %s>' % flatatt(final_attrs)]
+        str_values = set([str(v) for v in value]) # Normalize to strings.
+        for option_value, option_label in chain(self.choices, choices):
+            selected_html = (str(option_value) in str_values) and ' selected="selected"' or ''
+            output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(option_label)))
+        output.append(u'</select>')
+        return u'\n'.join(output)
+
+class RadioSelect(Widget):
+    pass
+
+class CheckboxSelectMultiple(Widget):
+    pass

django/template/__init__.py

     lib = libraries.get(module_name, None)
     if not lib:
         try:
-            mod = __import__(module_name, '', '', [''])
+            mod = __import__(module_name, {}, {}, [''])
         except ImportError, e:
             raise InvalidTemplateLibrary, "Could not load template library from %s, %s" % (module_name, e)
         try:

django/template/context.py

             i = path.rfind('.')
             module, attr = path[:i], path[i+1:]
             try:
-                mod = __import__(module, '', '', [attr])
+                mod = __import__(module, {}, {}, [attr])
             except ImportError, e:
                 raise ImproperlyConfigured, 'Error importing request processor module %s: "%s"' % (module, e)
             try:

django/template/loaders/app_directories.py

         m, a = app[:i], app[i+1:]
     try:
         if a is None:
-            mod = __import__(m, '', '', [])
+            mod = __import__(m, {}, {}, [])
         else:
-            mod = getattr(__import__(m, '', '', [a]), a)
+            mod = getattr(__import__(m, {}, {}, [a]), a)
     except ImportError, e:
         raise ImproperlyConfigured, 'ImportError %s: %s' % (app, e.args[0])
     template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')

django/templatetags/__init__.py

 
 for a in settings.INSTALLED_APPS:
     try:
-        __path__.extend(__import__(a + '.templatetags', '', '', ['']).__path__)
+        __path__.extend(__import__(a + '.templatetags', {}, {}, ['']).__path__)
     except ImportError:
         pass

django/test/simple.py

     # models module
     try:
         app_path = app_module.__name__.split('.')[:-1]
-        test_module = __import__('.'.join(app_path + [TEST_MODULE]), [], [], TEST_MODULE)
+        test_module = __import__('.'.join(app_path + [TEST_MODULE]), {}, {}, TEST_MODULE)
         
         suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_module))
         try:            

django/views/debug.py

         loader_debug_info = []
         for loader in template_source_loaders:
             try:
-                source_list_func = getattr(__import__(loader.__module__, '', '', ['get_template_sources']), 'get_template_sources')
+                source_list_func = getattr(__import__(loader.__module__, {}, {}, ['get_template_sources']), 'get_template_sources')
                 # NOTE: This assumes exc_value is the name of the template that
                 # the loader attempted to load.
                 template_list = [{'name': t, 'exists': os.path.exists(t)} \

docs/authentication.txt

     {% if messages %}
     <ul>
         {% for message in messages %}
-        <li>{{ message.message }}</li>
+        <li>{{ message }}</li>
         {% endfor %}
     </ul>
     {% endif %}

docs/generic_views.txt

     * ``extra_context``: A dictionary of values to add to the template
       context. By default, this is an empty dictionary. If a value in the
       dictionary is callable, the generic view will call it
-      just before rendering the template.
+      just before rendering the template. (**This is new in the
+      Django development version.**)
       
 **Example:**
 

docs/static_files.txt

 
 Just put this in your URLconf_::
 
-    (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}),
+    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}),
 
 ...where ``site_media`` is the URL where your media will be rooted, and
 ``/path/to/media`` is the filesystem root for your media.
 
 Example::
 
-    (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}),
+    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}),
 
 You can customize the index view by creating a template called
 ``static/directory_index``. That template gets two objects in its context:

tests/regressiontests/forms/tests.py

 >>> w.render('email', '', attrs={'class': 'special'})
 u'<input type="text" class="special" name="email" />'
 
+# PasswordInput Widget ############################################################
+
+>>> w = PasswordInput()
+>>> w.render('email', '')
+u'<input type="password" name="email" />'
+>>> w.render('email', None)
+u'<input type="password" name="email" />'
+>>> w.render('email', 'test@example.com')
+u'<input type="password" name="email" value="test@example.com" />'
+>>> w.render('email', 'some "quoted" & ampersanded value')
+u'<input type="password" name="email" value="some &quot;quoted&quot; &amp; ampersanded value" />'
+>>> w.render('email', 'test@example.com', attrs={'class': 'fun'})
+u'<input type="password" name="email" value="test@example.com" class="fun" />'
+
+You can also pass 'attrs' to the constructor:
+>>> w = PasswordInput(attrs={'class': 'fun'})
+>>> w.render('email', '')
+u'<input type="password" class="fun" name="email" />'
+>>> w.render('email', 'foo@example.com')
+u'<input type="password" class="fun" value="foo@example.com" name="email" />'
+
+'attrs' passed to render() get precedence over those passed to the constructor:
+>>> w = PasswordInput(attrs={'class': 'pretty'})
+>>> w.render('email', '', attrs={'class': 'special'})
+u'<input type="password" class="special" name="email" />'
+
+# HiddenInput Widget ############################################################
+
+>>> w = HiddenInput()
+>>> w.render('email', '')
+u'<input type="hidden" name="email" />'
+>>> w.render('email', None)
+u'<input type="hidden" name="email" />'
+>>> w.render('email', 'test@example.com')
+u'<input type="hidden" name="email" value="test@example.com" />'
+>>> w.render('email', 'some "quoted" & ampersanded value')
+u'<input type="hidden" name="email" value="some &quot;quoted&quot; &amp; ampersanded value" />'
+>>> w.render('email', 'test@example.com', attrs={'class': 'fun'})
+u'<input type="hidden" name="email" value="test@example.com" class="fun" />'
+
+You can also pass 'attrs' to the constructor:
+>>> w = HiddenInput(attrs={'class': 'fun'})
+>>> w.render('email', '')
+u'<input type="hidden" class="fun" name="email" />'
+>>> w.render('email', 'foo@example.com')
+u'<input type="hidden" class="fun" value="foo@example.com" name="email" />'
+
+'attrs' passed to render() get precedence over those passed to the constructor:
+>>> w = HiddenInput(attrs={'class': 'pretty'})
+>>> w.render('email', '', attrs={'class': 'special'})
+u'<input type="hidden" class="special" name="email" />'
+
+# FileInput Widget ############################################################
+
+>>> w = FileInput()
+>>> w.render('email', '')
+u'<input type="file" name="email" />'
+>>> w.render('email', None)
+u'<input type="file" name="email" />'
+>>> w.render('email', 'test@example.com')
+u'<input type="file" name="email" value="test@example.com" />'
+>>> w.render('email', 'some "quoted" & ampersanded value')
+u'<input type="file" name="email" value="some &quot;quoted&quot; &amp; ampersanded value" />'
+>>> w.render('email', 'test@example.com', attrs={'class': 'fun'})
+u'<input type="file" name="email" value="test@example.com" class="fun" />'
+
+You can also pass 'attrs' to the constructor:
+>>> w = FileInput(attrs={'class': 'fun'})
+>>> w.render('email', '')
+u'<input type="file" class="fun" name="email" />'
+>>> w.render('email', 'foo@example.com')
+u'<input type="file" class="fun" value="foo@example.com" name="email" />'
+
+'attrs' passed to render() get precedence over those passed to the constructor:
+>>> w = HiddenInput(attrs={'class': 'pretty'})
+>>> w.render('email', '', attrs={'class': 'special'})
+u'<input type="hidden" class="special" name="email" />'
+
 # Textarea Widget #############################################################
 
 >>> w = Textarea()
 >>> w.render('is_cool', '', attrs={'class': 'special'})
 u'<input type="checkbox" class="special" name="is_cool" />'
 
+# Select Widget ###############################################################
+
+>>> w = Select()
+>>> print w.render('beatle', 'J', choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select name="beatle">
+<option value="J" selected="selected">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+
+If the value is None, none of the options are selected:
+>>> print w.render('beatle', None, choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select name="beatle">
+<option value="J">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+
+If the value corresponds to a label (but not to an option value), none of the options are selected:
+>>> print w.render('beatle', 'John', choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select name="beatle">
+<option value="J">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+
+The value is compared to its str():
+>>> print w.render('num', 2, choices=[('1', '1'), ('2', '2'), ('3', '3')])
+<select name="num">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+>>> print w.render('num', '2', choices=[(1, 1), (2, 2), (3, 3)])
+<select name="num">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+>>> print w.render('num', 2, choices=[(1, 1), (2, 2), (3, 3)])
+<select name="num">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+
+The 'choices' argument can be any iterable:
+>>> def get_choices():
+...     for i in range(5):
+...         yield (i, i)
+>>> print w.render('num', 2, choices=get_choices())
+<select name="num">
+<option value="0">0</option>
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+<option value="4">4</option>
+</select>
+
+You can also pass 'choices' to the constructor:
+>>> w = Select(choices=[(1, 1), (2, 2), (3, 3)])
+>>> print w.render('num', 2)
+<select name="num">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+
+If 'choices' is passed to both the constructor and render(), then they'll both be in the output:
+>>> print w.render('num', 2, choices=[(4, 4), (5, 5)])
+<select name="num">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+<option value="4">4</option>
+<option value="5">5</option>
+</select>
+
+# SelectMultiple Widget #######################################################
+
+>>> w = SelectMultiple()
+>>> print w.render('beatles', ['J'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J" selected="selected">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+>>> print w.render('beatles', ['J', 'P'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J" selected="selected">John</option>
+<option value="P" selected="selected">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+>>> print w.render('beatles', ['J', 'P', 'R'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J" selected="selected">John</option>
+<option value="P" selected="selected">Paul</option>
+<option value="G">George</option>
+<option value="R" selected="selected">Ringo</option>
+</select>
+
+If the value is None, none of the options are selected:
+>>> print w.render('beatles', None, choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+
+If the value corresponds to a label (but not to an option value), none of the options are selected:
+>>> print w.render('beatles', ['John'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J">John</option>
+<option value="P">Paul</option>
+<option value="G">George</option>
+<option value="R">Ringo</option>
+</select>
+
+If multiple values are given, but some of them are not valid, the valid ones are selected:
+>>> print w.render('beatles', ['J', 'G', 'foo'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
+<select multiple="multiple" name="beatles">
+<option value="J" selected="selected">John</option>
+<option value="P">Paul</option>
+<option value="G" selected="selected">George</option>
+<option value="R">Ringo</option>
+</select>
+
+The value is compared to its str():
+>>> print w.render('nums', [2], choices=[('1', '1'), ('2', '2'), ('3', '3')])
+<select multiple="multiple" name="nums">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+>>> print w.render('nums', ['2'], choices=[(1, 1), (2, 2), (3, 3)])
+<select multiple="multiple" name="nums">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+>>> print w.render('nums', [2], choices=[(1, 1), (2, 2), (3, 3)])
+<select multiple="multiple" name="nums">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+
+The 'choices' argument can be any iterable:
+>>> def get_choices():
+...     for i in range(5):
+...         yield (i, i)
+>>> print w.render('nums', [2], choices=get_choices())
+<select multiple="multiple" name="nums">
+<option value="0">0</option>
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+<option value="4">4</option>
+</select>
+
+You can also pass 'choices' to the constructor:
+>>> w = SelectMultiple(choices=[(1, 1), (2, 2), (3, 3)])
+>>> print w.render('nums', [2])
+<select multiple="multiple" name="nums">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+</select>
+
+If 'choices' is passed to both the constructor and render(), then they'll both be in the output:
+>>> print w.render('nums', [2], choices=[(4, 4), (5, 5)])
+<select multiple="multiple" name="nums">
+<option value="1">1</option>
+<option value="2" selected="selected">2</option>
+<option value="3">3</option>
+<option value="4">4</option>
+<option value="5">5</option>
+</select>
+
 # CharField ###################################################################
 
 >>> f = CharField(required=False)
->>> f.to_python(1)
+>>> f.clean(1)
 u'1'
->>> f.to_python('hello')
+>>> f.clean('hello')
 u'hello'