Changeset 1235
- Timestamp:
- 11/14/05 19:36:12 (3 years ago)
- Files:
-
- django/branches/new-admin/django/bin/daily_cleanup.py (modified) (1 diff)
- django/branches/new-admin/django/conf/locale/cs/LC_MESSAGES/django.po (modified) (21 diffs)
- django/branches/new-admin/django/conf/locale/is (added)
- django/branches/new-admin/django/conf/locale/is/LC_MESSAGES (added)
- django/branches/new-admin/django/conf/locale/is/LC_MESSAGES/django.mo (added)
- django/branches/new-admin/django/conf/locale/is/LC_MESSAGES/django.po (added)
- django/branches/new-admin/django/conf/locale/sk/LC_MESSAGES/django.mo (modified) (previous)
- django/branches/new-admin/django/conf/locale/sk/LC_MESSAGES/django.po (modified) (4 diffs)
- django/branches/new-admin/django/contrib/admin/templatetags/admin_list.py (modified) (1 diff)
- django/branches/new-admin/django/contrib/admin/views/main.py (modified) (2 diffs)
- django/branches/new-admin/django/contrib/syndication/feeds.py (modified) (5 diffs)
- django/branches/new-admin/django/contrib/syndication/views.py (modified) (1 diff)
- django/branches/new-admin/django/core/db/backends/ado_mssql.py (modified) (1 diff)
- django/branches/new-admin/django/core/db/backends/postgresql.py (modified) (1 diff)
- django/branches/new-admin/django/core/handlers/base.py (modified) (4 diffs)
- django/branches/new-admin/django/core/management.py (modified) (19 diffs)
- django/branches/new-admin/django/core/meta/__init__.py (modified) (22 diffs)
- django/branches/new-admin/django/models/auth.py (modified) (1 diff)
- django/branches/new-admin/django/templatetags/i18n.py (modified) (1 diff)
- django/branches/new-admin/django/utils/feedgenerator.py (modified) (7 diffs)
- django/branches/new-admin/django/views/debug.py (added)
- django/branches/new-admin/docs/model-api.txt (modified) (4 diffs)
- django/branches/new-admin/docs/syndication_feeds.txt (modified) (4 diffs)
- django/branches/new-admin/tests/testapp/models/__init__.py (modified) (1 diff)
- django/branches/new-admin/tests/testapp/models/reserved_names.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/new-admin/django/bin/daily_cleanup.py
r518 r1235 8 8 # Clean up old database records 9 9 cursor = db.cursor() 10 cursor.execute("DELETE FROM core_sessions WHERE expire_date < NOW()") 11 cursor.execute("DELETE FROM registration_challenges WHERE request_date < NOW() - INTERVAL '1 week'") 10 cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \ 11 (db.quote_name('core_sessions'), db.quote_name('expire_date'))) 12 cursor.execute("DELETE FROM %s WHERE %s < NOW() - INTERVAL '1 week'" % \ 13 (db.quote_name('registration_challenges'), db.quote_name('request_date'))) 12 14 db.commit() 13 15 django/branches/new-admin/django/conf/locale/cs/LC_MESSAGES/django.po
r1223 r1235 15 15 "Content-Type: text/plain; charset=utf-8\n" 16 16 "Content-Transfer-Encoding: 8bit\n" 17 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" 18 "10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" 17 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" 19 18 "X-Poedit-Language: Czech\n" 20 19 "X-Poedit-Country: CZECH REPUBLIC\n" … … 264 263 265 264 #: contrib/admin/templates/admin/500.html:10 266 msgid "" 267 "There's been an error. It's been reported to the site administrators via e-" 268 "mail and should be fixed shortly. Thanks for your patience." 269 msgstr "" 270 "Nastala chyba. Ta byla oznámena administrátorovi serveru pomocí e-mailu a " 271 "měla by být brzy odstraněna. Děkujeme za trpělivost." 265 msgid "There's been an error. It's been reported to the site administrators via e-mail and should be fixed shortly. Thanks for your patience." 266 msgstr "Nastala chyba. Ta byla oznámena administrátorovi serveru pomocí e-mailu a měla by být brzy odstraněna. Děkujeme za trpělivost." 272 267 273 268 #: contrib/admin/templates/admin/404.html:4 … … 360 355 #: contrib/admin/templates/admin/delete_confirmation.html:7 361 356 #, fuzzy, python-format 362 msgid "" 363 "Deleting the %(object_name)s '%(object)s' would result in deleting related " 364 "objects, but your account doesn't have permission to delete the following " 365 "types of objects:" 366 msgstr "" 367 "Mazání %(object_name)s '%(object)s' by vyústilo ve vymazání souvisejících " 368 "objektů, ale Váš účet nemá oprávnění pro mazání následujících typů objektů:" 357 msgid "Deleting the %(object_name)s '%(object)s' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:" 358 msgstr "Mazání %(object_name)s '%(object)s' by vyústilo ve vymazání souvisejících objektů, ale Váš účet nemá oprávnění pro mazání následujících typů objektů:" 369 359 370 360 #: contrib/admin/templates/admin/change_form.html:20 … … 409 399 #: contrib/admin/templates/admin/delete_confirmation.html:14 410 400 #, python-format 411 msgid "" 412 "Are you sure you want to delete the %(object_name)s \"%(object)s\"? All of " 413 "the following related items will be deleted:" 414 msgstr "" 415 "Jste si jist(á), že chcete smazat %(object_name)s \"%(object)s\"? Všechny " 416 "následující související položky budou smazány:" 401 msgid "Are you sure you want to delete the %(object_name)s \"%(object)s\"? All of the following related items will be deleted:" 402 msgstr "Jste si jist(á), že chcete smazat %(object_name)s \"%(object)s\"? Všechny následující související položky budou smazány:" 417 403 418 404 #: contrib/admin/templates/admin/delete_confirmation.html:18 … … 443 429 444 430 #: contrib/admin/templates/registration/password_reset_form.html:12 445 msgid "" 446 "Forgotten your password? Enter your e-mail address below, and we'll reset " 447 "your password and e-mail the new one to you." 448 msgstr "" 449 "Zapomněl(a) jste heslo? Vložte níže Vaši e-mailovou adresu a my Vaše heslo " 450 "obnovíme a zašleme Vám e-mailem nové." 431 msgid "Forgotten your password? Enter your e-mail address below, and we'll reset your password and e-mail the new one to you." 432 msgstr "Zapomněl(a) jste heslo? Vložte níže Vaši e-mailovou adresu a my Vaše heslo obnovíme a zašleme Vám e-mailem nové." 451 433 452 434 #: contrib/admin/templates/registration/password_reset_form.html:16 … … 472 454 473 455 #: contrib/admin/templates/registration/password_reset_done.html:12 474 msgid "" 475 "We've e-mailed a new password to the e-mail address you submitted. You " 476 "should be receiving it shortly." 477 msgstr "" 478 "Poslali jsme Vám e-mailem nové heslo na adresu, kterou jste zadal(a). Měl(a) " 479 "byste ji dostat během okamžiku." 456 msgid "We've e-mailed a new password to the e-mail address you submitted. You should be receiving it shortly." 457 msgstr "Poslali jsme Vám e-mailem nové heslo na adresu, kterou jste zadal(a). Měl(a) byste ji dostat během okamžiku." 480 458 481 459 #: contrib/admin/templates/registration/password_change_form.html:12 482 msgid "" 483 "Please enter your old password, for security's sake, and then enter your new " 484 "password twice so we can verify you typed it in correctly." 485 msgstr "" 486 "Prosíme, pro zabezpečení vložte svoje staré heslo a poté vložte dvakrát nové " 487 "heslo, takže můžeme ověřit, že jste ho napsal(a) správně." 460 msgid "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." 461 msgstr "Prosíme, pro zabezpečení vložte svoje staré heslo a poté vložte dvakrát nové heslo, takže můžeme ověřit, že jste ho napsal(a) správně." 488 462 489 463 #: contrib/admin/templates/registration/password_change_form.html:17 … … 568 542 #: utils/translation.py:335 569 543 msgid "DATE_FORMAT" 570 msgstr " "544 msgstr "Formát data" 571 545 572 546 #: utils/translation.py:336 573 547 msgid "DATETIME_FORMAT" 574 msgstr " "548 msgstr "Formát data a času" 575 549 576 550 #: utils/translation.py:337 577 551 msgid "TIME_FORMAT" 578 msgstr " "552 msgstr "Formát času" 579 553 580 554 #: utils/dates.py:6 … … 614 588 msgstr "Únor" 615 589 616 #: utils/dates.py:14 utils/dates.py:27 590 #: utils/dates.py:14 591 #: utils/dates.py:27 617 592 msgid "March" 618 593 msgstr "Březen" 619 594 620 #: utils/dates.py:14 utils/dates.py:27 595 #: utils/dates.py:14 596 #: utils/dates.py:27 621 597 msgid "April" 622 598 msgstr "Duben" 623 599 624 #: utils/dates.py:14 utils/dates.py:27 600 #: utils/dates.py:14 601 #: utils/dates.py:27 625 602 msgid "May" 626 603 msgstr "Květen" 627 604 628 #: utils/dates.py:14 utils/dates.py:27 605 #: utils/dates.py:14 606 #: utils/dates.py:27 629 607 msgid "June" 630 608 msgstr "Červen" 631 609 632 #: utils/dates.py:15 utils/dates.py:27 610 #: utils/dates.py:15 611 #: utils/dates.py:27 633 612 msgid "July" 634 613 msgstr "Červenec" … … 702 681 msgstr "nadpis" 703 682 704 #: models/core.py:29 models/core.py:40 models/auth.py:6 models/auth.py:19 683 #: models/core.py:29 684 #: models/core.py:40 685 #: models/auth.py:6 686 #: models/auth.py:19 705 687 msgid "name" 706 688 msgstr "jméno" … … 833 815 msgstr "Oprávnění" 834 816 835 #: models/auth.py:11 models/auth.py:58 817 #: models/auth.py:11 818 #: models/auth.py:58 836 819 msgid "Permissions" 837 820 msgstr "Oprávnění" … … 841 824 msgstr "Skupina" 842 825 843 #: models/auth.py:23 models/auth.py:60 826 #: models/auth.py:23 827 #: models/auth.py:60 844 828 msgid "Groups" 845 829 msgstr "Skupiny" … … 895 879 896 880 #: models/auth.py:44 897 msgid "" 898 "In addition to the permissions manually assigned, this user will also get " 899 "all permissions granted to each group he/she is in." 900 msgstr "" 901 "Kromě manuálně přidělených oprávnění uživatel dostane všechna oprávnění pro " 902 "každou skupinu, ve které je." 881 msgid "In addition to the permissions manually assigned, this user will also get all permissions granted to each group he/she is in." 882 msgstr "Kromě manuálně přidělených oprávnění uživatel dostane všechna oprávnění pro každou skupinu, ve které je." 903 883 904 884 #: models/auth.py:48 … … 952 932 #: conf/global_settings.py:44 953 933 msgid "Icelandic" 954 msgstr " "934 msgstr "Islandština" 955 935 956 936 #: conf/global_settings.py:45 … … 988 968 #: core/validators.py:63 989 969 msgid "This value must contain only letters, numbers, underscores and slashes." 990 msgstr "" 991 "Tato hodnota musí obsahovat pouze znaky, čísla, podtržítka nebo lomítka." 970 msgstr "Tato hodnota musí obsahovat pouze znaky, čísla, podtržítka nebo lomítka." 992 971 993 972 #: core/validators.py:71 … … 1048 1027 1049 1028 #: core/validators.py:147 1050 msgid "" 1051 "Upload a valid image. The file you uploaded was either not an image or a " 1052 "corrupted image." 1053 msgstr "" 1054 "Nahrajte na server platný obrázek. Soubor, který jste nahrál(a) nebyl " 1055 "obrázek, nebo byl porušen." 1029 msgid "Upload a valid image. The file you uploaded was either not an image or a corrupted image." 1030 msgstr "Nahrajte na server platný obrázek. Soubor, který jste nahrál(a) nebyl obrázek, nebo byl porušen." 1056 1031 1057 1032 #: core/validators.py:154 … … 1093 1068 msgstr "Neplatné URL: %s" 1094 1069 1095 #: core/validators.py:205 core/validators.py:207 1070 #: core/validators.py:205 1071 #: core/validators.py:207 1096 1072 #, python-format 1097 1073 msgid "The URL %s is a broken link." … … 1119 1095 msgstr "Prosíme, vložte něco alespoň pro jedno pole." 1120 1096 1121 #: core/validators.py:263 core/validators.py:274 1097 #: core/validators.py:263 1098 #: core/validators.py:274 1122 1099 msgid "Please enter both fields or leave them both empty." 1123 1100 msgstr "Prosíme, vložte obě pole, nebo je nechte obě prázdná." … … 1149 1126 #, python-format 1150 1127 msgid "Please enter a valid decimal number with at most %s total digit." 1151 msgid_plural "" 1152 "Please enter a valid decimal number with at most %s total digits." 1128 msgid_plural "Please enter a valid decimal number with at most %s total digits." 1153 1129 msgstr[0] "Prosíme, vložte platné číslo s nejvíce %s cifrou celkem." 1154 1130 msgstr[1] "Prosíme, vložte platné číslo s nejvíce %s ciframi celkem." … … 1158 1134 #, python-format 1159 1135 msgid "Please enter a valid decimal number with at most %s decimal place." 1160 msgid_plural "" 1161 "Please enter a valid decimal number with at most %s decimal places." 1162 msgstr[0] "" 1163 "Prosíme, vložte platné číslo s nejvíce %s cifrou za desetinnou čárkou celkem." 1164 msgstr[1] "" 1165 "Prosíme, vložte platné číslo s nejvíce %s ciframi za desetinnou čárkou " 1166 "celkem." 1167 msgstr[2] "" 1168 "Prosíme, vložte platné číslo s nejvíce %s ciframi za desetinnou čárkou " 1169 "celkem." 1136 msgid_plural "Please enter a valid decimal number with at most %s decimal places." 1137 msgstr[0] "Prosíme, vložte platné číslo s nejvíce %s cifrou za desetinnou čárkou celkem." 1138 msgstr[1] "Prosíme, vložte platné číslo s nejvíce %s ciframi za desetinnou čárkou celkem." 1139 msgstr[2] "Prosíme, vložte platné číslo s nejvíce %s ciframi za desetinnou čárkou celkem." 1170 1140 1171 1141 #: core/validators.py:361 … … 1194 1164 #: core/validators.py:428 1195 1165 #, python-format 1196 msgid "" 1197 "The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'." 1166 msgid "The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'." 1198 1167 msgstr "URL %(url)s vrátilo neplatnou hlavičku Content-Type '%(contenttype)s'." 1199 1168 1200 1169 #: core/validators.py:461 1201 1170 #, python-format 1202 msgid "" 1203 "Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with " 1204 "\"%(start)s\".)" 1205 msgstr "" 1206 "Prosíme, zavřete nezavřenou značku %(tag)s z řádky %(line)s. (Řádka začíná s " 1207 "\"%(start)s\".)" 1171 msgid "Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with \"%(start)s\".)" 1172 msgstr "Prosíme, zavřete nezavřenou značku %(tag)s z řádky %(line)s. (Řádka začíná s \"%(start)s\".)" 1208 1173 1209 1174 #: core/validators.py:465 1210 1175 #, python-format 1211 msgid "" 1212 "Some text starting on line %(line)s is not allowed in that context. (Line " 1213 "starts with \"%(start)s\".)" 1214 msgstr "" 1215 "Nějaký text začínající na řádce %(line)s není povolen v tomto kontextu. " 1216 "(Řádka začíná s \"%(start)s\".)" 1176 msgid "Some text starting on line %(line)s is not allowed in that context. (Line starts with \"%(start)s\".)" 1177 msgstr "Nějaký text začínající na řádce %(line)s není povolen v tomto kontextu. (Řádka začíná s \"%(start)s\".)" 1217 1178 1218 1179 #: core/validators.py:470 1219 1180 #, python-format 1220 msgid "" 1221 "\"%(attr)s\" on line %(line)s is an invalid attribute. (Line starts with \"%" 1222 "(start)s\".)" 1223 msgstr "" 1224 "\"%(attr)s\" na řádce %(line)s je neplatný atribut. (Řádka začíná s \"%" 1225 "(start)s\".)" 1181 msgid "\"%(attr)s\" on line %(line)s is an invalid attribute. (Line starts with \"%(start)s\".)" 1182 msgstr "\"%(attr)s\" na řádce %(line)s je neplatný atribut. (Řádka začíná s \"%(start)s\".)" 1226 1183 1227 1184 #: core/validators.py:475 1228 1185 #, python-format 1229 msgid "" 1230 "\"<%(tag)s>\" on line %(line)s is an invalid tag. (Line starts with \"%" 1231 "(start)s\".)" 1232 msgstr "" 1233 "\"<%(tag)s>\" na řádce %(line)s je neplatná značka. (Řádka začíná s \"%" 1234 "(start)s\".)" 1186 msgid "\"<%(tag)s>\" on line %(line)s is an invalid tag. (Line starts with \"%(start)s\".)" 1187 msgstr "\"<%(tag)s>\" na řádce %(line)s je neplatná značka. (Řádka začíná s \"%(start)s\".)" 1235 1188 1236 1189 #: core/validators.py:479 1237 1190 #, python-format 1238 msgid "" 1239 "A tag on line %(line)s is missing one or more required attributes. (Line " 1240 "starts with \"%(start)s\".)" 1241 msgstr "" 1242 "Značce na řádce %(line)s schází jeden nebo více požadovaných atributů. " 1243 "(Řádka začíná s \"%(start)s\".)" 1191 msgid "A tag on line %(line)s is missing one or more required attributes. (Line starts with \"%(start)s\".)" 1192 msgstr "Značce na řádce %(line)s schází jeden nebo více požadovaných atributů. (Řádka začíná s \"%(start)s\".)" 1244 1193 1245 1194 #: core/validators.py:484 1246 1195 #, python-format 1247 msgid "" 1248 "The \"%(attr)s\" attribute on line %(line)s has an invalid value. (Line " 1249 "starts with \"%(start)s\".)" 1250 msgstr "" 1251 "Atribut \"%(attr)s\" na řádce %(line)s má neplatnou hodnotu. (Řádka začína s " 1252 "\"%(start)s\".)" 1196 msgid "The \"%(attr)s\" attribute on line %(line)s has an invalid value. (Line starts with \"%(start)s\".)" 1197 msgstr "Atribut \"%(attr)s\" na řádce %(line)s má neplatnou hodnotu. (Řádka začína s \"%(start)s\".)" 1253 1198 1254 1199 #: core/meta/fields.py:114 … … 1257 1202 1258 1203 #: core/meta/fields.py:117 1259 msgid "" 1260 " Hold down \"Control\", or \"Command\" on a Mac, to select more than one." 1261 msgstr "" 1262 "Podržte \"Control\", nebo \"Command\" na Macu pro vybrání více jak jedné " 1263 "položky." 1204 msgid " Hold down \"Control\", or \"Command\" on a Mac, to select more than one." 1205 msgstr "Podržte \"Control\", nebo \"Command\" na Macu pro vybrání více jak jedné položky." 1206 django/branches/new-admin/django/conf/locale/sk/LC_MESSAGES/django.po
r1223 r1235 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: Vladimir Labath <vlado@labath.org>\n" 14 "Language-Team: Slovak < info@labath.org>\n"14 "Language-Team: Slovak <sk@li.org>\n" 15 15 "MIME-Version: 1.0\n" 16 16 "Content-Type: text/plain; charset=utf-8\n" … … 569 569 msgstr "" 570 570 571 #: utils/translation.py:335572 msgid "DATE_FORMAT"573 msgstr ""574 575 #: utils/translation.py:336576 msgid "DATETIME_FORMAT"577 msgstr ""578 579 #: utils/translation.py:337580 msgid "TIME_FORMAT"581 msgstr ""582 583 571 #: utils/dates.py:6 584 572 msgid "Monday" … … 685 673 msgstr "" 686 674 675 #: utils/translation.py:335 676 msgid "DATE_FORMAT" 677 msgstr "DATUM_FORMAT" 678 679 #: utils/translation.py:336 680 msgid "DATETIME_FORMAT" 681 msgstr "DATUMCAS_FORMAT" 682 683 #: utils/translation.py:337 684 msgid "TIME_FORMAT" 685 msgstr "CAS_FORMAT" 686 687 687 #: models/core.py:7 688 688 msgid "domain name" … … 917 917 msgstr "Dôležité údaje" 918 918 919 #: models/auth.py:1 82919 #: models/auth.py:195 920 920 msgid "Message" 921 921 msgstr "Zpráva" django/branches/new-admin/django/contrib/admin/templatetags/admin_list.py
r1223 r1235 210 210 if first: # First column is a special case 211 211 first = False 212 result_id = getattr(result, pk)213 yield ('<th%s><a href="%s /"%s>%s</a></th>' % \214 (row_class, result_id, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr))212 url = cl.url_for_result(result) 213 yield ('<th%s><a href="%s"%s>%s</a></th>' % \ 214 (row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr)) 215 215 else: 216 216 yield ('<td%s>%s</td>' % (row_class, result_repr)) django/branches/new-admin/django/contrib/admin/views/main.py
r1154 r1235 209 209 or _('Select %s to change') % self.opts.verbose_name) 210 210 self.get_filters(request) 211 self.pk_attname = self.lookup_opts.pk.attname 211 212 212 213 def get_filters(self, request): … … 302 303 full_result_count, result_list, can_show_all, multi_page, paginator ) 303 304 305 def url_for_result(self, result): 306 return "%s/" % getattr(result, self.pk_attname) 307 304 308 def get_ordering(self): 305 309 lookup_opts, params = self.lookup_opts, self.params django/branches/new-admin/django/contrib/syndication/feeds.py
r1198 r1235 18 18 feed_type = feedgenerator.DefaultFeed 19 19 20 def __init__(self, slug ):20 def __init__(self, slug, feed_url): 21 21 self.slug = slug 22 self.feed_url = feed_url 22 23 23 24 def item_link(self, item): … … 27 28 raise ImproperlyConfigured, "Give your %s class a get_absolute_url() method, or define an item_link() method in your Feed class." % item.__class__.__name__ 28 29 29 def __get_dynamic_attr(self, attname, obj): 30 attr = getattr(self, attname) 30 def __get_dynamic_attr(self, attname, obj, default=None): 31 try: 32 attr = getattr(self, attname) 33 except AttributeError: 34 return default 31 35 if callable(attr): 32 36 try: … … 57 61 link = link, 58 62 description = self.__get_dynamic_attr('description', obj), 59 language = LANGUAGE_CODE.decode() 63 language = LANGUAGE_CODE.decode(), 64 feed_url = add_domain(current_site, self.feed_url), 65 author_name = self.__get_dynamic_attr('author_name', obj), 66 author_link = self.__get_dynamic_attr('author_link', obj), 67 author_email = self.__get_dynamic_attr('author_email', obj), 60 68 ) 61 69 … … 79 87 mime_type = self.__get_dynamic_attr('item_enclosure_mime_type', item).decode('utf-8'), 80 88 ) 89 author_name = self.__get_dynamic_attr('item_author_name', item) 90 if author_name is not None: 91 author_email = self.__get_dynamic_attr('item_author_email', item) 92 author_link = self.__get_dynamic_attr('item_author_link', item) 93 else: 94 author_email = author_link = None 81 95 feed.add_item( 82 96 title = title_template.render(Context({'obj': item, 'site': current_site})).decode('utf-8'), … … 86 100 enclosure = enc, 87 101 pubdate = self.__get_dynamic_attr('item_pubdate', item), 102 author_name = author_name, 103 author_email = author_email, 104 author_link = author_link, 88 105 ) 89 106 return feed django/branches/new-admin/django/contrib/syndication/views.py
r1223 r1235 18 18 19 19 try: 20 feedgen = f(slug ).get_feed(param)20 feedgen = f(slug, request.path).get_feed(param) 21 21 except feeds.FeedDoesNotExist: 22 22 raise Http404, "Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not." % slug django/branches/new-admin/django/core/db/backends/ado_mssql.py
r1223 r1235 150 150 'OneToOneField': 'int', 151 151 'PhoneNumberField': 'varchar(20)', 152 'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%( name)s] CHECK ([%(name)s] > 0)',153 'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%( name)s] CHECK ([%(name)s] > 0)',152 'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)', 153 'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)', 154 154 'SlugField': 'varchar(50)', 155 155 'SmallIntegerField': 'smallint', django/branches/new-admin/django/core/db/backends/postgresql.py
r1223 r1235 171 171 'OneToOneField': 'integer', 172 172 'PhoneNumberField': 'varchar(20)', 173 'PositiveIntegerField': 'integer CHECK (%( name)s >= 0)',174 'PositiveSmallIntegerField': 'smallint CHECK (%( name)s >= 0)',173 'PositiveIntegerField': 'integer CHECK (%(column)s >= 0)', 174 'PositiveSmallIntegerField': 'smallint CHECK (%(column)s >= 0)', 175 175 'SlugField': 'varchar(50)', 176 176 'SmallIntegerField': 'smallint', django/branches/new-admin/django/core/handlers/base.py
r1023 r1235 87 87 except exceptions.Http404, e: 88 88 if DEBUG: 89 return self.get_technical_error_response( is404=True, exception=e)89 return self.get_technical_error_response(request, is404=True, exception=e) 90 90 else: 91 91 callback, param_dict = resolver.resolve404() … … 94 94 db.db.rollback() 95 95 if DEBUG: 96 return self.get_technical_error_response( )96 return self.get_technical_error_response(request) 97 97 else: 98 98 subject = 'Database error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) … … 104 104 except: # Handle everything else, including SuspiciousOperation, etc. 105 105 if DEBUG: 106 return self.get_technical_error_response( )106 return self.get_technical_error_response(request) 107 107 else: 108 108 subject = 'Coding error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) … … 124 124 return callback(request, **param_dict) 125 125 126 def get_technical_error_response(self, is404=False, exception=None):126 def get_technical_error_response(self, request, is404=False, exception=None): 127 127 """ 128 128 Returns an HttpResponse that displays a TECHNICAL error message for a 129 129 fundamental database or coding error. 130 130 """ 131 import sys 132 from django.views import debug 131 133 if is404: 132 from django.conf.settings import ROOT_URLCONF 133 from django.utils.html import escape 134 html = ['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'] 135 html.append('<html><head><title>Error 404</title>') 136 # Explicitly tell robots not to archive this, in case this slips 137 # onto a production site. 138 html.append('<meta name="robots" content="NONE,NOARCHIVE" />') 139 html.append('</head><body><h1>Error 404</h1>') 140 try: 141 tried = exception.args[0]['tried'] 142 except (IndexError, TypeError): 143 if exception.args: 144 html.append('<p>%s</p>' % escape(exception.args[0])) 145 else: 146 html.append('<p>Using the URLconf defined in <code>%s</code>, Django tried these URL patterns, in this order:</p>' % ROOT_URLCONF) 147 html.append('<ul>%s</ul>' % ''.join(['<li><code>%s</code></li>' % escape(t).replace(' ', ' ') for t in tried])) 148 html.append("<p>The current URL, <code><strong>%r</strong></code>, didn't match any of these.</p>" % exception.args[0]['path']) 149 html.append("<hr /><p>You're seeing this error because you have <code>DEBUG = True</code> in your Django settings file. Change that to <code>False</code>, and Django will display a standard 404 page.</p>") 150 html.append('</body></html>') 151 return httpwrappers.HttpResponseNotFound('\n'.join(html)) 134 return debug.technical_404_response(request, exception) 152 135 else: 153 output = "There's been an error:\n\n%s" % self._get_traceback() 154 return httpwrappers.HttpResponseServerError(output, mimetype='text/plain') 136 return debug.technical_500_response(request, *sys.exc_info()) 155 137 156 138 def _get_traceback(self): django/branches/new-admin/django/core/management.py
r1154 r1235 20 20 21 21 def _get_packages_insert(app_label): 22 return "INSERT INTO packages (label, name) VALUES ('%s', '%s');" % (app_label, app_label) 22 from django.core.db import db 23 return "INSERT INTO %s (%s, %s) VALUES ('%s', '%s');" % \ 24 (db.quote_name('packages'), db.quote_name('label'), db.quote_name('name'), 25 app_label, app_label) 23 26 24 27 def _get_permission_codename(action, opts): … … 34 37 35 38 def _get_permission_insert(name, codename, opts): 36 return "INSERT INTO auth_permissions (name, package, codename) VALUES ('%s', '%s', '%s');" % \ 37 (name.replace("'", "''"), opts.app_label, codename) 39 from django.core.db import db 40 return "INSERT INTO %s (%s, %s, %s) VALUES ('%s', '%s', '%s');" % \ 41 (db.quote_name('auth_permissions'), db.quote_name('name'), db.quote_name('package'), 42 db.quote_name('codename'), name.replace("'", "''"), opts.app_label, codename) 38 43 39 44 def _get_contenttype_insert(opts): 40 return "INSERT INTO content_types (name, package, python_module_name) VALUES ('%s', '%s', '%s');" % \ 41 (opts.verbose_name, opts.app_label, opts.module_name) 45 from django.core.db import db 46 return "INSERT INTO %s (%s, %s, %s) VALUES ('%s', '%s', '%s');" % \ 47 (db.quote_name('content_types'), db.quote_name('name'), db.quote_name('package'), 48 db.quote_name('python_module_name'), opts.verbose_name, opts.app_label, opts.module_name) 42 49 43 50 def _is_valid_dir_name(s): … … 65 72 col_type = db.DATA_TYPES[data_type] 66 73 if col_type is not None: 67 field_output = [ f.column, col_type % rel_field.__dict__]74 field_output = [db.db.quote_name(f.column), col_type % rel_field.__dict__] 68 75 field_output.append('%sNULL' % (not f.null and 'NOT ' or '')) 69 76 if f.unique: … … 73 80 if f.rel: 74 81 field_output.append('REFERENCES %s (%s)' % \ 75 (f.rel.to.db_table, f.rel.to.get_field(f.rel.field_name).column)) 82 (db.db.quote_name(f.rel.to.db_table), 83 db.db.quote_name(f.rel.to.get_field(f.rel.field_name).column))) 76 84 table_output.append(' '.join(field_output)) 77 85 if opts.order_with_respect_to: 78 table_output.append(' _order %s NULL' % db.DATA_TYPES['IntegerField'])86 table_output.append('%s %s NULL' % (db.db.quote_name('_order'), db.DATA_TYPES['IntegerField'])) 79 87 for field_constraints in opts.unique_together: 80 table_output.append('UNIQUE (%s)' % ", ".join([opts.get_field(f).column for f in field_constraints])) 81 82 full_statement = ['CREATE TABLE %s (' % opts.db_table] 88 table_output.append('UNIQUE (%s)' % \ 89 ", ".join([db.db.quote_name(opts.get_field(f).column) for f in field_constraints])) 90 91 full_statement = ['CREATE TABLE %s (' % db.db.quote_name(opts.db_table)] 83 92 for i, line in enumerate(table_output): # Combine and add commas. 84 93 full_statement.append(' %s%s' % (line, i < len(table_output)-1 and ',' or '')) … … 89 98 opts = klass._meta 90 99 for f in opts.many_to_many: 91 table_output = ['CREATE TABLE %s (' % f.get_m2m_db_table(opts)] 92 table_output.append(' id %s NOT NULL PRIMARY KEY,' % db.DATA_TYPES['AutoField']) 93 table_output.append(' %s_id %s NOT NULL REFERENCES %s (%s),' % \ 94 (opts.object_name.lower(), db.DATA_TYPES[get_rel_data_type(opts.pk)] % opts.pk.__dict__, opts.db_table, opts.pk.column)) 95 table_output.append(' %s_id %s NOT NULL REFERENCES %s (%s),' % \ 96 (f.rel.to.object_name.lower(), db.DATA_TYPES[get_rel_data_type(f.rel.to.pk)] % f.rel.to.pk.__dict__, f.rel.to.db_table, f.rel.to.pk.column)) 97 table_output.append(' UNIQUE (%s_id, %s_id)' % (opts.object_name.lower(), f.rel.to.object_name.lower())) 100 table_output = ['CREATE TABLE %s (' % db.db.quote_name(f.get_m2m_db_table(opts))] 101 table_output.append(' %s %s NOT NULL PRIMARY KEY,' % (db.db.quote_name('id'), db.DATA_TYPES['AutoField'])) 102 table_output.append(' %s %s NOT NULL REFERENCES %s (%s),' % \ 103 (db.db.quote_name(opts.object_name.lower() + '_id'), 104 db.DATA_TYPES[get_rel_data_type(opts.pk)] % opts.pk.__dict__, 105 db.db.quote_name(opts.db_table), 106 db.db.quote_name(opts.pk.column))) 107 table_output.append(' %s %s NOT NULL REFERENCES %s (%s),' % \ 108 (db.db.quote_name(f.rel.to.object_name.lower() + '_id'), 109 db.DATA_TYPES[get_rel_data_type(f.rel.to.pk)] % f.rel.to.pk.__dict__, 110 db.db.quote_name(f.rel.to.db_table), 111 db.db.quote_name(f.rel.to.pk.column))) 112 table_output.append(' UNIQUE (%s, %s)' % \ 113 (db.db.quote_name(opts.object_name.lower() + '_id'), 114 db.db.quote_name(f.rel.to.object_name.lower() + '_id'))) 98 115 table_output.append(');') 99 116 final_output.append('\n'.join(table_output)) … … 115 132 if cursor is not None: 116 133 # Check whether the table exists. 117 cursor.execute("SELECT 1 FROM django_admin_log LIMIT 1")134 cursor.execute("SELECT 1 FROM %s LIMIT 1" % db.db.quote_name('django_admin_log')) 118 135 except: 119 136 # The table doesn't exist, so it doesn't need to be dropped. … … 130 147 if cursor is not None: 131 148 # Check whether the table exists. 132 cursor.execute("SELECT 1 FROM %s LIMIT 1" % klass._meta.db_table)149 cursor.execute("SELECT 1 FROM %s LIMIT 1" % db.db.quote_name(klass._meta.db_table)) 133 150 except: 134 151 # The table doesn't exist, so it doesn't need to be dropped. 135 152 db.db.rollback() 136 153 else: 137 output.append("DROP TABLE %s;" % klass._meta.db_table)154 output.append("DROP TABLE %s;" % db.db.quote_name(klass._meta.db_table)) 138 155 139 156 # Output DROP TABLE statements for many-to-many tables. … … 143 160 try: 144 161 if cursor is not None: 145 cursor.execute("SELECT 1 FROM %s LIMIT 1" % f.get_m2m_db_table(opts))162 cursor.execute("SELECT 1 FROM %s LIMIT 1" % db.db.quote_name(f.get_m2m_db_table(opts))) 146 163 except: 147 164 db.db.rollback() 148 165 else: 149 output.append("DROP TABLE %s;" % f.get_m2m_db_table(opts))166 output.append("DROP TABLE %s;" % db.db.quote_name(f.get_m2m_db_table(opts))) 150 167 151 168 app_label = mod._MODELS[0]._meta.app_label 152 169 153 170 # Delete from packages, auth_permissions, content_types. 154 output.append("DELETE FROM packages WHERE label = '%s';" % app_label) 155 output.append("DELETE FROM auth_permissions WHERE package = '%s';" % app_label) 156 output.append("DELETE FROM content_types WHERE package = '%s';" % app_label) 171 output.append("DELETE FROM %s WHERE %s = '%s';" % \ 172 (db.db.quote_name('packages'), db.db.quote_name('label'), app_label)) 173 output.append("DELETE FROM %s WHERE %s = '%s';" % \ 174 (db.db.quote_name('auth_permissions'), db.db.quote_name('package'), app_label)) 175 output.append("DELETE FROM %s WHERE %s = '%s';" % \ 176 (db.db.quote_name('content_types'), db.db.quote_name('package'), app_label)) 157 177 158 178 # Delete from the admin log. 159 179 if cursor is not None: 160 cursor.execute("SELECT id FROM content_types WHERE package = %s", [app_label]) 180 cursor.execute("SELECT %s FROM %s WHERE %s = %%s" % \ 181 (db.db.quote_name('id'), db.db.quote_name('content_types'), 182 db.db.quote_name('package')), [app_label]) 161 183 if admin_log_exists: 162 184 for row in cursor.fetchall(): 163 output.append("DELETE FROM django_admin_log WHERE content_type_id = %s;" % row[0]) 185 output.append("DELETE FROM %s WHERE %s = %s;" % \ 186 (db.db.quote_name('django_admin_log'), db.db.quote_name('content_type_id'), row[0])) 164 187 165 188 # Close database connection explicitly, in case this output is being piped … … 207 230 def get_sql_sequence_reset(mod): 208 231 "Returns a list of the SQL statements to reset PostgreSQL sequences for the given module." 209 from django.core import meta232 from django.core import db, meta 210 233 output = [] 211 234 for klass in mod._MODELS: 212 235 for f in klass._meta.fields: 213 236 if isinstance(f, meta.AutoField): 214 output.append("SELECT setval('%s_%s_seq', (SELECT max(%s) FROM %s));" % (klass._meta.db_table, f.column, f.column, klass._meta.db_table)) 237 output.append("SELECT setval('%s_%s_seq', (SELECT max(%s) FROM %s));" % \ 238 (klass._meta.db_table, f.column, db.db.quote_name(f.column), 239 db.db.quote_name(klass._meta.db_table))) 215 240 return output 216 241 get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting PostgreSQL sequences for the given model module name(s)." … … 219 244 def get_sql_indexes(mod): 220 245 "Returns a list of the CREATE INDEX SQL statements for the given module." 246 from django.core.db import db 221 247 output = [] 222 248 for klass in mod._MODELS: … … 225 251 unique = f.unique and "UNIQUE " or "" 226 252 output.append("CREATE %sINDEX %s_%s ON %s (%s);" % \ 227 (unique, klass._meta.db_table, f.column, klass._meta.db_table, f.column)) 253 (unique, klass._meta.db_table, f.column, 254 db.quote_name(klass._meta.db_table), db.quote_name(f.column))) 228 255 return output 229 256 get_sql_indexes.help_doc = "Prints the CREATE INDEX SQL statements for the given model module name(s)." … … 243 270 244 271 # Check that the package exists in the database. 245 cursor.execute("SELECT 1 FROM packages WHERE label = %s", [app_label]) 272 cursor.execute("SELECT 1 FROM %s WHERE %s = %%s" % \ 273 (db.db.quote_name('packages'), db.db.quote_name('label')), [app_label]) 246 274 if cursor.rowcount < 1: 247 275 # sys.stderr.write("The '%s' package isn't installed.\n" % app_label) … … 257 285 contenttypes_seen[opts.module_name] = 1 258 286 for codename, name in perms: 259 cursor.execute("SELECT 1 FROM auth_permissions WHERE package = %s AND codename = %s", (app_label, codename)) 287 cursor.execute("SELECT 1 FROM %s WHERE %s = %%s AND %s = %%s" % \ 288 (db.db.quote_name('auth_permissions'), db.db.quote_name('package'), 289 db.db.quote_name('codename')), (app_label, codename)) 260 290 if cursor.rowcount < 1: 261 291 # sys.stderr.write("The '%s.%s' permission doesn't exist.\n" % (app_label, codename)) 262 292 print _get_permission_insert(name, codename, opts) 263 cursor.execute("SELECT 1 FROM content_types WHERE package = %s AND python_module_name = %s", (app_label, opts.module_name)) 293 cursor.execute("SELECT 1 FROM %s WHERE %s = %%s AND %s = %%s" % \ 294 (db.db.quote_name('content_types'), db.db.quote_name('package'), 295 db.db.quote_name('python_module_name')), (app_label, opts.module_name)) 264 296 if cursor.rowcount < 1: 265 297 # sys.stderr.write("The '%s.%s' content type doesn't exist.\n" % (app_label, opts.module_name)) … … 268 300 # Check that there aren't any *extra* permissions in the DB that the model 269 301 # doesn't know about. 270 cursor.execute("SELECT codename FROM auth_permissions WHERE package = %s", (app_label,)) 302 cursor.execute("SELECT %s FROM %s WHERE %s = %%s" % \ 303 (db.db.quote_name('codename'), db.db.quote_name('auth_permissions'), 304 db.db.quote_name('package')), (app_label,)) 271 305 for row in cursor.fetchall(): 272 306 try: … … 274 308 except KeyError: 275 309 # sys.stderr.write("A permission called '%s.%s' was found in the database but not in the model.\n" % (app_label, row[0])) 276 print "DELETE FROM auth_permissions WHERE package='%s' AND codename = '%s';" % (app_label, row[0]) 310 print "DELETE FROM %s WHERE %s='%s' AND %s = '%s';" % \ 311 (db.db.quote_name('auth_permissions'), db.db.quote_name('package'), 312 app_label, db.db.quote_name('codename'), row[0]) 277 313 278 314 # Check that there aren't any *extra* content types in the DB that the 279 315 # model doesn't know about. 280 cursor.execute("SELECT python_module_name FROM content_types WHERE package = %s", (app_label,)) 316 cursor.execute("SELECT %s FROM %s WHERE %s = %%s" % \ 317 (db.db.quote_name('python_module_name'), db.db.quote_name('content_types'), 318 db.db.quote_name('package')), (app_label,)) 281 319 for row in cursor.fetchall(): 282 320 try: … … 284 322 except KeyError: <
