Django

Code

Show
Ignore:
Timestamp:
06/19/06 10:23:57 (2 years ago)
Author:
jkocherhans
Message:

multi-auth: Merged to [3151]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/multi-auth/tests/modeltests/custom_pk/models.py

    r3086 r3152  
    99 
    1010class Employee(models.Model): 
    11     employee_code = models.CharField(maxlength=10, primary_key=True) 
     11    employee_code = models.CharField(maxlength=10, primary_key=True, 
     12            db_column = 'code') 
    1213    first_name = models.CharField(maxlength=20) 
    1314    last_name = models.CharField(maxlength=20) 
  • django/branches/multi-auth/tests/modeltests/invalid_models/models.py

    r3052 r3152  
    7575invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute. 
    7676invalid_models.fielderrors: "prepopulate": prepopulate_from should be a list or tuple. 
    77 invalid_models.fielderrors: "choices": "choices" should be either a tuple or list
     77invalid_models.fielderrors: "choices": "choices" should be iterable (e.g., a tuple or list)
    7878invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples. 
    7979invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples. 
  • django/branches/multi-auth/tests/modeltests/properties/models.py

    r3052 r3152  
    1313    def _get_full_name(self): 
    1414        return "%s %s" % (self.first_name, self.last_name) 
     15 
     16    def _set_full_name(self, combined_name): 
     17        self.first_name, self.last_name = combined_name.split(' ', 1) 
     18 
    1519    full_name = property(_get_full_name) 
     20 
     21    full_name_2 = property(_get_full_name, _set_full_name) 
    1622 
    1723API_TESTS = """ 
     
    2632    ... 
    2733AttributeError: can't set attribute 
     34 
     35# But "full_name_2" has, and it can be used to initialise the class. 
     36>>> a2 = Person(full_name_2 = 'Paul McCartney') 
     37>>> a2.save() 
     38>>> a2.first_name 
     39'Paul' 
    2840""" 
  • django/branches/multi-auth/tests/othertests/templates.py

    r2965 r3152  
    170170 
    171171    ### CYCLE TAG ############################################################# 
    172     #'cycleXX': ('', {}, ''), 
    173     'cycle01': ('{% cycle a, %}', {}, 'a'), 
     172    'cycle01': ('{% cycle a %}', {}, template.TemplateSyntaxError), 
    174173    'cycle02': ('{% cycle a,b,c as abc %}{% cycle abc %}', {}, 'ab'), 
    175174    'cycle03': ('{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}', {}, 'abc'), 
     
    194193 
    195194    ### FILTER TAG ############################################################ 
    196     #'filterXX': ('', {}, ''), 
    197195    'filter01': ('{% filter upper %}{% endfilter %}', {}, ''), 
    198196    'filter02': ('{% filter upper %}django{% endfilter %}', {}, 'DJANGO'), 
     
    200198 
    201199    ### FIRSTOF TAG ########################################################### 
    202     #'firstofXX': ('', {}, ''), 
    203200    'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''), 
    204201    'firstof02': ('{% firstof a b c %}', {'a':1,'b':0,'c':0}, '1'), 
     
    221218    'if-tag03': ("{% if foo %}yes{% else %}no{% endif %}", {}, "no"), 
    222219 
     220    # AND 
     221    'if-tag-and01': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 
     222    'if-tag-and02': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 
     223    'if-tag-and03': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 
     224    'if-tag-and04': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 
     225    'if-tag-and05': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False}, 'no'), 
     226    'if-tag-and06': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'bar': False}, 'no'), 
     227    'if-tag-and07': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True}, 'no'), 
     228    'if-tag-and08': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'bar': True}, 'no'), 
     229 
     230    # OR 
     231    'if-tag-or01': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 
     232    'if-tag-or02': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 
     233    'if-tag-or03': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 
     234    'if-tag-or04': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 
     235    'if-tag-or05': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False}, 'no'), 
     236    'if-tag-or06': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'bar': False}, 'no'), 
     237    'if-tag-or07': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True}, 'yes'), 
     238    'if-tag-or08': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'bar': True}, 'yes'), 
     239 
     240    # TODO: multiple ORs 
     241 
     242    # NOT 
     243    'if-tag-not01': ("{% if not foo %}no{% else %}yes{% endif %}", {'foo': True}, 'yes'), 
     244    'if-tag-not02': ("{% if not %}yes{% else %}no{% endif %}", {'foo': True}, 'no'), 
     245    'if-tag-not03': ("{% if not %}yes{% else %}no{% endif %}", {'not': True}, 'yes'), 
     246    'if-tag-not04': ("{% if not not %}no{% else %}yes{% endif %}", {'not': True}, 'yes'), 
     247    'if-tag-not05': ("{% if not not %}no{% else %}yes{% endif %}", {}, 'no'), 
     248 
     249    'if-tag-not06': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {}, 'no'), 
     250    'if-tag-not07': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 
     251    'if-tag-not08': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 
     252    'if-tag-not09': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 
     253    'if-tag-not10': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 
     254 
     255    'if-tag-not11': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {}, 'no'), 
     256    'if-tag-not12': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 
     257    'if-tag-not13': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 
     258    'if-tag-not14': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 
     259    'if-tag-not15': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 
     260 
     261    'if-tag-not16': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 
     262    'if-tag-not17': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 
     263    'if-tag-not18': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 
     264    'if-tag-not19': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 
     265    'if-tag-not20': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 
     266 
     267    'if-tag-not21': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {}, 'yes'), 
     268    'if-tag-not22': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 
     269    'if-tag-not23': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 
     270    'if-tag-not24': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 
     271    'if-tag-not25': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 
     272 
     273    'if-tag-not26': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 
     274    'if-tag-not27': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 
     275    'if-tag-not28': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 
     276    'if-tag-not29': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 
     277    'if-tag-not30': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 
     278 
     279    'if-tag-not31': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 
     280    'if-tag-not32': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 
     281    'if-tag-not33': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 
     282    'if-tag-not34': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 
     283    'if-tag-not35': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 
     284 
     285    # AND and OR raises a TemplateSyntaxError 
     286    'if-tag-error01': ("{% if foo or bar and baz %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, template.TemplateSyntaxError), 
     287    'if-tag-error02': ("{% if foo and %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 
     288    'if-tag-error03': ("{% if foo or %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 
     289    'if-tag-error04': ("{% if not foo and %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 
     290    'if-tag-error05': ("{% if not foo or %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 
     291 
    223292    ### IFCHANGED TAG ######################################################### 
    224     #'ifchangedXX': ('', {}, ''), 
    225293    'ifchanged01': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,2,3) }, '123'), 
    226294    'ifchanged02': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,1,3) }, '13'), 
     
    238306    'ifequal09': ('{% ifequal a "test" %}yes{% else %}no{% endifequal %}', {}, "no"), 
    239307    'ifequal10': ('{% ifequal a b %}yes{% else %}no{% endifequal %}', {}, "yes"), 
     308 
     309    # SMART SPLITTING 
     310    'ifequal-split01': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {}, "no"), 
     311    'ifequal-split02': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {'a': 'foo'}, "no"), 
     312    'ifequal-split03': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {'a': 'test man'}, "yes"), 
     313    'ifequal-split04': ("{% ifequal a 'test man' %}yes{% else %}no{% endifequal %}", {'a': 'test man'}, "yes"), 
     314    'ifequal-split05': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': ''}, "no"), 
     315    'ifequal-split06': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': 'i "love" you'}, "yes"), 
     316    'ifequal-split07': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': 'i love you'}, "no"), 
     317    'ifequal-split08': (r"{% ifequal a 'I\'m happy' %}yes{% else %}no{% endifequal %}", {'a': "I'm happy"}, "yes"), 
     318    'ifequal-split09': (r"{% ifequal a 'slash\man' %}yes{% else %}no{% endifequal %}", {'a': r"slash\man"}, "yes"), 
     319    'ifequal-split10': (r"{% ifequal a 'slash\man' %}yes{% else %}no{% endifequal %}", {'a': r"slashman"}, "no"), 
    240320 
    241321    ### IFNOTEQUAL TAG ######################################################## 
     
    389469 
    390470    ### REGROUP TAG ########################################################### 
    391     #'regroupXX': ('', {}, ''), 
    392471    'regroup01': ('{% regroup data by bar as grouped %}' + \ 
    393472                  '{% for group in grouped %}' + \ 
     
    415494 
    416495    ### TEMPLATETAG TAG ####################################################### 
    417     #'templatetagXX': ('', {}, ''), 
    418496    'templatetag01': ('{% templatetag openblock %}', {}, '{%'), 
    419497    'templatetag02': ('{% templatetag closeblock %}', {}, '%}'), 
     
    422500    'templatetag05': ('{% templatetag %}', {}, template.TemplateSyntaxError), 
    423501    'templatetag06': ('{% templatetag foo %}', {}, template.TemplateSyntaxError), 
     502    'templatetag07': ('{% templatetag openbrace %}', {}, '{'), 
     503    'templatetag08': ('{% templatetag closebrace %}', {}, '}'), 
     504    'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'), 
     505    'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'), 
    424506 
    425507    ### WIDTHRATIO TAG ######################################################## 
    426     #'widthratioXX': ('', {}, ''), 
    427508    'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'), 
    428509    'widthratio02': ('{% widthratio a b 100 %}', {'a':0,'b':0}, ''), 
     
    441522    'widthratio09': ('{% widthratio a b %}', {'a':50,'b':100}, template.TemplateSyntaxError), 
    442523    'widthratio10': ('{% widthratio a b 100.0 %}', {'a':50,'b':100}, template.TemplateSyntaxError), 
    443      
     524 
    444525    ### NOW TAG ######################################################## 
    445526    # Simple case 
    446527    'now01' : ('{% now "j n Y"%}', {}, str(datetime.now().day) + ' ' + str(datetime.now().month) + ' ' + str(datetime.now().year)), 
    447      
     528 
    448529    # Check parsing of escaped and special characters 
    449530    'now02' : ('{% now "j "n" Y"%}', {}, template.TemplateSyntaxError), 
  • django/branches/multi-auth/tests/runtests.py

    r2998 r3152  
    2222 
    2323ALWAYS_INSTALLED_APPS = [ 
    24     'django.contrib.admin', 
     24    'django.contrib.contenttypes', 
    2525    'django.contrib.auth',  
    26     'django.contrib.comments', 
    27     'django.contrib.contenttypes', 
     26    'django.contrib.sites', 
    2827    'django.contrib.flatpages', 
    2928    'django.contrib.redirects', 
    3029    'django.contrib.sessions', 
    31     'django.contrib.sites', 
     30    'django.contrib.comments', 
     31    'django.contrib.admin', 
    3232] 
    3333 
     
    149149        # Initialize the test database. 
    150150        cursor = connection.cursor() 
     151         
     152        # Install the core always installed apps 
     153        for app in ALWAYS_INSTALLED_APPS: 
     154            self.output(1, "Installing contrib app %s" % app) 
     155            mod = __import__(app + ".models", '', '', ['']) 
     156            management.install(mod) 
    151157 
    152158        # Run the tests for each test model.