Django

Code

Changeset 1586

Show
Ignore:
Timestamp:
12/08/05 22:29:20 (3 years ago)
Author:
adrian
Message:

Moved custom unit-test templatetag library into the unit test module itself, to fix errors when running the test module directly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/othertests/templates.py

    r1443 r1586  
    99import traceback 
    1010 
    11 # Helper objects for template tests 
     11################################# 
     12# Custom template tag for tests # 
     13################################# 
     14 
     15register = template.Library() 
     16 
     17class EchoNode(template.Node): 
     18    def __init__(self, contents): 
     19        self.contents = contents 
     20 
     21    def render(self, context): 
     22        return " ".join(self.contents) 
     23 
     24def do_echo(parser, token): 
     25    return EchoNode(token.contents.split()[1:]) 
     26 
     27register.tag("echo", do_echo) 
     28 
     29template.libraries['django.templatetags.testtags'] = register 
     30 
     31##################################### 
     32# Helper objects for template tests # 
     33##################################### 
     34 
    1235class SomeClass: 
    1336    def __init__(self):