Django

Code

Changeset 7136

Show
Ignore:
Timestamp:
02/19/08 19:59:59 (10 months ago)
Author:
mtredinnick
Message:

queryset-refactor: Merged from turnk up to [7135] because I need some stuff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/queryset-refactor/AUTHORS

    r7124 r7136  
    5757    Jökull Sólberg Auðunsson <jokullsolberg@gmail.com> 
    5858    Arthur <avandorp@gmail.com> 
     59    David Avsajanishvili <avsd05@gmail.com> 
    5960    axiak@mit.edu 
    6061    Jiri Barton 
  • django/branches/queryset-refactor/django/conf/global_settings.py

    r7124 r7136  
    5353    ('fi', gettext_noop('Finnish')), 
    5454    ('fr', gettext_noop('French')), 
    55     ('ga', gettext_noop('Gaeilge')), 
     55    ('ga', gettext_noop('Irish')), 
    5656    ('gl', gettext_noop('Galician')), 
    5757    ('hu', gettext_noop('Hungarian')), 
     
    6161    ('it', gettext_noop('Italian')), 
    6262    ('ja', gettext_noop('Japanese')), 
     63    ('ka', gettext_noop('Georgian')), 
    6364    ('ko', gettext_noop('Korean')), 
    6465    ('km', gettext_noop('Khmer')), 
  • django/branches/queryset-refactor/django/contrib/admin/views/decorators.py

    r6690 r7136  
    66from django.utils.translation import ugettext_lazy, ugettext as _ 
    77from django.utils.safestring import mark_safe 
    8 import base64, datetime, md5 
     8import base64, md5 
    99import cPickle as pickle 
    1010 
  • django/branches/queryset-refactor/django/contrib/databrowse/plugins/calendars.py

    r6690 r7136  
    99from django.utils.safestring import mark_safe 
    1010from django.views.generic import date_based 
    11 import datetime 
    12 import time 
    1311 
    1412class CalendarPlugin(DatabrowsePlugin): 
  • django/branches/queryset-refactor/django/contrib/databrowse/plugins/fieldchoices.py

    r6690 r7136  
    88from django.utils.safestring import mark_safe 
    99from django.views.generic import date_based 
    10 import datetime 
    11 import time 
    1210import urllib 
    1311 
  • django/branches/queryset-refactor/django/contrib/databrowse/views.py

    r5876 r7136  
    33from django.shortcuts import render_to_response 
    44from django.contrib.databrowse.datastructures import EasyModel, EasyChoice 
    5 import datetime 
    6 import time 
    75 
    86########### 
  • django/branches/queryset-refactor/django/contrib/formtools/preview.py

    r6756 r7136  
    44 
    55from django.conf import settings 
    6 from django.core.exceptions import ImproperlyConfigured 
    76from django.http import Http404 
    87from django.shortcuts import render_to_response 
  • django/branches/queryset-refactor/django/contrib/formtools/tests.py

    r6753 r7136  
    44from django.conf import settings 
    55from django.test import TestCase 
    6 from django.test.client import Client 
    7  
    86 
    97success_string = "Done was called!" 
     
    8987        self.assertEqual(response.content, success_string) 
    9088 
    91  
    92 if __name__ == '__main__': 
    93     unittest.main() 
  • django/branches/queryset-refactor/django/contrib/humanize/templatetags/humanize.py

    r6690 r7136  
    33from django import template 
    44from django.template import defaultfilters 
    5 from django.conf import settings 
    6 from datetime import date, timedelta 
     5from datetime import date 
    76import re 
    87 
  • django/branches/queryset-refactor/django/contrib/localflavor/ar/forms.py

    r7086 r7136  
    88from django.utils.encoding import smart_unicode 
    99from django.utils.translation import ugettext 
    10 import re 
    1110 
    1211class ARProvinceSelect(Select): 
  • django/branches/queryset-refactor/django/contrib/localflavor/jp/forms.py

    r6954 r7136  
    77from django.utils.translation import ugettext 
    88from django.newforms.fields import RegexField, Select 
    9  
    10 import re 
    119 
    1210class JPPostalCodeField(RegexField): 
  • django/branches/queryset-refactor/django/contrib/sessions/models.py

    r6857 r7136  
    1 import os 
    2 import sys 
    3 import time 
    4 import datetime 
    51import base64 
    62import md5 
    7 import random 
    83import cPickle as pickle 
    94 
  • django/branches/queryset-refactor/django/contrib/webdesign/tests.py

    r6339 r7136  
    1515 
    1616from django.contrib.webdesign.lorem_ipsum import * 
    17 import datetime 
    1817 
    1918if __name__ == '__main__': 
  • django/branches/queryset-refactor/django/core/serializers/json.py

    r6954 r7136  
    55import datetime 
    66from django.utils import simplejson 
    7 from django.utils.simplejson import decoder 
    87from django.core.serializers.python import Serializer as PythonSerializer 
    98from django.core.serializers.python import Deserializer as PythonDeserializer 
  • django/branches/queryset-refactor/django/core/serializers/pyyaml.py

    r6954 r7136  
    55""" 
    66 
    7 import datetime 
    87from django.db import models 
    98from django.core.serializers.python import Serializer as PythonSerializer 
  • django/branches/queryset-refactor/django/db/backends/mysql/base.py

    r6690 r7136  
    2222from MySQLdb.converters import conversions 
    2323from MySQLdb.constants import FIELD_TYPE 
    24 import types 
    2524import re 
    2625 
  • django/branches/queryset-refactor/django/db/models/base.py

    r7126 r7136  
    160160    def __ne__(self, other): 
    161161        return not self.__eq__(other) 
     162 
     163    def __hash__(self): 
     164        return hash(self._get_pk_val()) 
    162165 
    163166    def __init__(self, *args, **kwargs): 
  • django/branches/queryset-refactor/django/db/models/fields/__init__.py

    r7126 r7136  
    463463        Field.__init__(self, *args, **kwargs) 
    464464 
     465    def get_internal_type(self): 
     466        return "BooleanField" 
     467 
    465468    def to_python(self, value): 
    466469        if value in (True, False): return value 
     
    480483    def get_manipulator_field_objs(self): 
    481484        return [oldforms.TextField] 
     485 
     486    def get_internal_type(self): 
     487        return "CharField" 
    482488 
    483489    def to_python(self, value): 
     
    510516            kwargs['blank'] = True 
    511517        Field.__init__(self, verbose_name, name, **kwargs) 
     518 
     519    def get_internal_type(self): 
     520        return "DateField" 
    512521 
    513522    def to_python(self, value): 
     
    580589 
    581590class DateTimeField(DateField): 
     591    def get_internal_type(self): 
     592        return "DateTimeField" 
     593 
    582594    def to_python(self, value): 
    583595        if value is None: 
     
    650662        Field.__init__(self, verbose_name, name, **kwargs) 
    651663 
     664    def get_internal_type(self): 
     665        return "DecimalField" 
     666 
    652667    def to_python(self, value): 
    653668        if value is None: 
     
    709724        CharField.__init__(self, *args, **kwargs) 
    710725 
    711     def get_internal_type(self): 
    712         return "CharField" 
    713  
    714726    def get_manipulator_field_objs(self): 
    715727        return [oldforms.EmailField] 
     
    728740        kwargs['max_length'] = kwargs.get('max_length', 100) 
    729741        Field.__init__(self, verbose_name, name, **kwargs) 
     742 
     743    def get_internal_type(self): 
     744        return "FileField" 
    730745 
    731746    def get_db_prep_save(self, value): 
     
    838853        return [curry(oldforms.FilePathField, path=self.path, match=self.match, recursive=self.recursive)] 
    839854 
     855    def get_internal_type(self): 
     856        return "FilePathField" 
     857 
    840858class FloatField(Field): 
    841859    empty_strings_allowed = False 
     
    843861    def get_manipulator_field_objs(self): 
    844862        return [oldforms.FloatField] 
     863 
     864    def get_internal_type(self): 
     865        return "FloatField" 
    845866 
    846867    def formfield(self, **kwargs): 
     
    865886        if not self.height_field: 
    866887            setattr(cls, 'get_%s_height' % self.name, curry(cls._get_FIELD_height, field=self)) 
     888 
     889    def get_internal_type(self): 
     890        return "ImageField" 
    867891 
    868892    def save_file(self, new_data, new_object, original_object, change, rel, save=True): 
     
    888912        return [oldforms.IntegerField] 
    889913 
     914    def get_internal_type(self): 
     915        return "IntegerField" 
     916 
    890917    def formfield(self, **kwargs): 
    891918        defaults = {'form_class': forms.IntegerField} 
     
    902929        return [oldforms.IPAddressField] 
    903930 
     931    def get_internal_type(self): 
     932        return "IPAddressField" 
     933 
    904934    def validate(self, field_data, all_data): 
    905935        validators.isValidIPAddress4(field_data, None) 
     
    915945        kwargs['null'] = True 
    916946        Field.__init__(self, *args, **kwargs) 
     947 
     948    def get_internal_type(self): 
     949        return "NullBooleanField" 
    917950 
    918951    def to_python(self, value): 
     
    935968        return [oldforms.PhoneNumberField] 
    936969 
     970    def get_internal_type(self): 
     971        return "PhoneNumberField" 
     972 
    937973    def validate(self, field_data, all_data): 
    938974        validators.isValidPhone(field_data, all_data) 
     
    948984        return [oldforms.PositiveIntegerField] 
    949985 
     986    def get_internal_type(self): 
     987        return "PositiveIntegerField" 
     988 
    950989    def formfield(self, **kwargs): 
    951990        defaults = {'min_value': 0} 
     
    956995    def get_manipulator_field_objs(self): 
    957996        return [oldforms.PositiveSmallIntegerField] 
     997 
     998    def get_internal_type(self): 
     999        return "PositiveSmallIntegerField" 
    9581000 
    9591001    def formfield(self, **kwargs): 
     
    9711013        super(SlugField, self).__init__(*args, **kwargs) 
    9721014 
     1015    def get_internal_type(self): 
     1016        return "SlugField" 
     1017 
    9731018class SmallIntegerField(IntegerField): 
    9741019    def get_manipulator_field_objs(self): 
    9751020        return [oldforms.SmallIntegerField] 
    9761021 
     1022    def get_internal_type(self): 
     1023        return "SmallIntegerField" 
     1024 
    9771025class TextField(Field): 
    9781026    def get_manipulator_field_objs(self): 
    9791027        return [oldforms.LargeTextField] 
     1028 
     1029    def get_internal_type(self): 
     1030        return "TextField" 
    9801031 
    9811032    def formfield(self, **kwargs): 
     
    9911042            kwargs['editable'] = False 
    9921043        Field.__init__(self, verbose_name, name, **kwargs) 
     1044 
     1045    def get_internal_type(self): 
     1046        return "TimeField" 
    9931047 
    9941048    def get_db_prep_lookup(self, lookup_type, value): 
     
    10561110        return [oldforms.URLField] 
    10571111 
    1058     def get_internal_type(self): 
    1059         return "CharField" 
    1060  
    10611112    def formfield(self, **kwargs): 
    10621113        defaults = {'form_class': forms.URLField, 'verify_exists': self.verify_exists} 
     
    10671118    def get_manipulator_field_objs(self): 
    10681119        return [oldforms.USStateField] 
     1120 
     1121    def get_internal_type(self): 
     1122        return "USStateField" 
    10691123 
    10701124    def formfield(self, **kwargs): 
     
    10781132        self.schema_path = schema_path 
    10791133        Field.__init__(self, verbose_name, name, **kwargs) 
    1080  
    1081     def get_internal_type(self): 
    1082         return "TextField" 
    10831134 
    10841135    def get_manipulator_field_objs(self): 
     
    10921143        IntegerField.__init__(self, **kwargs ) 
    10931144 
    1094     def get_internal_type(self): 
    1095         return "IntegerField" 
    1096  
    10971145    def get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True): 
    10981146        return [oldforms.HiddenField(name_prefix + self.name)] 
  • django/branches/queryset-refactor/django/test/client.py

    r7086 r7136  
    1 import datetime 
    21import sys 
    32from cStringIO import StringIO 
    4 from urlparse import urlparse 
    53from django.conf import settings 
    64from django.contrib.auth import authenticate, login 
  • django/branches/queryset-refactor/django/test/_doctest.py

    r6857 r7136  
    101101import __future__ 
    102102 
    103 import sys, traceback, inspect, linecache, os, re, types 
     103import sys, traceback, inspect, linecache, os, re 
    104104import unittest, difflib, pdb, tempfile 
    105105import warnings 
  • django/branches/queryset-refactor/django/test/simple.py

    r5769 r7136  
    147147     
    148148    return len(result.failures) + len(result.errors) 
    149      
  • django/branches/queryset-refactor/django/utils/datastructures.py

    r7124 r7136  
    146146        # This way of initializing the copy means it works for subclasses, too. 
    147147        obj = self.__class__(self) 
    148         obj.keyOrder = self.keyOrder 
     148        obj.keyOrder = self.keyOrder[:] 
    149149        return obj 
    150150 
  • django/branches/queryset-refactor/docs/db-api.txt

    r7043 r7136  
    17591759    print e.blog  # Doesn't hit the database; uses cached version. 
    17601760 
    1761 ``select_related()`` is documented in the "QuerySet methods that return new 
    1762 QuerySets" section above. 
     1761``select_related()`` is documented in the `QuerySet methods that return new QuerySets`_ section above. 
    17631762 
    17641763Backward 
  • django/branches/queryset-refactor/docs/faq.txt

    r6005 r7136  
    354354 
    355355.. _`win32 build of mod_python for Python 2.4`: http://www.lehuen.com/nicolas/index.php/2005/02/21/39-win32-build-of-mod_python-314-for-python-24 
    356 .. _`Django on Windows howto`: http://thinkhole.org/wp/2006/04/03/django-on-windows-howto
     356.. _`Django on Windows howto`: http://thinkhole.org/wp/django-on-windows
    357357.. _`Running mod_python on Apache on Windows2000`: http://groups-beta.google.com/group/comp.lang.python/msg/139af8c83a5a9d4f 
    358358.. _`guide to getting mod_python working`: http://www.dscpl.com.au/articles/modpython-001.html 
  • django/branches/queryset-refactor/docs/serialization.txt

    r6857 r7136  
    8989    for deserialized_object in serializers.deserialize("xml", data): 
    9090        if object_should_be_saved(deserialized_object): 
    91             obj.save() 
     91            deserialized_object.save() 
    9292 
    9393In other words, the usual use is to examine the deserialized objects to make 
  • django/branches/queryset-refactor/docs/templates_python.txt

    r7029 r7136  
    396396~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    397397 
     398**New in Django development version** 
     399 
    398400If ``TEMPLATE_CONTEXT_PROCESSORS`` contains this processor, every 
    399401``RequestContext`` will contain a variable ``MEDIA_URL``, providing the 
     
    10151017 
    10161018    def render(self, context): 
    1017         t = template.load_template('small_fragment.html') 
     1019        t = template.loader.get_template('small_fragment.html') 
    10181020        return t.render(Context({'var': obj}, autoescape=context.autoescape)) 
    10191021 
  • django/branches/queryset-refactor/tests/modeltests/basic/models.py

    r6466 r7136  
    55This is a basic model with only two non-primary-key fields. 
    66""" 
     7 
     8try: 
     9    set 
     10except NameError: 
     11    from sets import Set as set 
    712 
    813from django.db import models 
     
    390395>>> Article.objects.get(pk=a.id).headline 
    391396u'\u6797\u539f \u3081\u3050\u307f' 
     397 
     398# Model instances have a hash function, so they can be used in sets or as 
     399# dictionary keys. Two models compare as equal if their primary keys are equal. 
     400>>> s = set([a10, a11, a12]) 
     401>>> Article.objects.get(headline='Article 11') in s 
     402True 
    392403""" 
  • django/branches/queryset-refactor/tests/regressiontests/datastructures/tests.py

    r7086 r7136  
    7878>>> d.keys() == d.copy().keys() 
    7979True 
     80>>> d2 = d.copy() 
     81>>> d2['four'] = 'four' 
    8082>>> print repr(d) 
    8183{'one': 'not one', 'two': 'two', 'three': 'three'}