<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -69,6 +69,7 @@ TEMPLATE_DIRS = (
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
+    'django.contrib.comments',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',</diff>
      <filename>test_project/settings.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,35 @@
+import os
 from django.test.testcases import TestCase
 from django.template import Context, Template
 from django.contrib.auth.models import User
 from test_utils.templatetags import TemplateParser
+from test_utils.testmaker import Testmaker
+
+from django.contrib.auth.models import User
 
 class Parsing(TestCase):
    &quot;&quot;&quot;
    Tests to test the parsing API
    &quot;&quot;&quot;
 
+   def setUp(self):
+      self.tm = Testmaker()
+      self.tm.setup_logging('test_file', 'serialize_file')
+
+   def tearDown(self):
+      #Teardown logging somehow?
+      os.remove('test_file')
+      os.remove('serialize_file')
+
    def test_basic_parsing(self):
-      t = TemplateParser('{% load test %}{% test parser_obj as as_var %}{{ as_var }}')
+      user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
+      user.save()
+      c = Context({'object': user})
+      t = TemplateParser('{% load comments %}{% get_comment_list for object as as_var %}{{ as_var }}', c)
       t.parse()
-      self.assertEquals(t.template_calls[0], '{% test parser_obj as as_var %}')
-      self.assertEquals(t.loaded_classes[0], '{% load test %}')
+      self.assertEquals(t.template_calls[0], '{% get_comment_list for object as as_var %}')
+      self.assertEquals(t.loaded_classes[0], '{% load comments %}')
+      t.create_tests()
+      logs = open('test_file')
+      output = logs.read()
+      self.assertTrue(output.find(&quot;{'object': get_model('auth', 'user')&quot;) != -1)</diff>
      <filename>test_project/test_app/tests/templatetags_tests.py</filename>
    </modified>
    <modified>
      <diff>@@ -4,6 +4,8 @@ from django.conf import settings
 from django.template.loaders.filesystem import load_template_source
 from django import template
 
+from test_utils.testmaker import Testmaker
+
 DEFAULT_TAGS = ['autoescape' , 'block' , 'comment' , 'cycle' , 'debug' ,
 'extends' , 'filter' , 'firstof' , 'for' , 'if' , 'else',
 'ifchanged' , 'ifequal' , 'ifnotequal' , 'include' , 'load' , 'now' ,
@@ -44,6 +46,10 @@ class TemplateParser(object):
         Thus we have to loop over the file, splitting on the regex, then
         looping over the split, matching for our regex again.
         Improvements welcome!
+
+        End result::
+            self.loaded_classes contains the load commands of classes loaded
+            self.template_calls contains the template calls
         &quot;&quot;&quot;
         for line in self.template_string.split('\n'):
             split_line = tag_re.split(line)
@@ -52,7 +58,7 @@ class TemplateParser(object):
                     mat = tag_re.search(matched)
                     if mat:
                         full_command = mat.group(0)
-                        cmd =  mat.group(2).split()[0].strip() #tokens
+                        cmd =  mat.group(2).split()[0].strip() #get_comment_form etc
                         if cmd == 'load':
                             self.loaded_classes.append(full_command)
                         else:
@@ -66,30 +72,31 @@ class TemplateParser(object):
         the outputted template.
         &quot;&quot;&quot;
         for tag_string in self.template_calls:
-                #Try and find anything in the string that's in the context
-                context_name = ''
-                bits = tag_string.split()
-                for bit_num, bit in enumerate(bits):
-                    try:
-                        out_context[bit] = template.Variable(bit).resolve(self.context)
-                    except:
-                        pass
-                    if bit == 'as':
-                        context_name = bits[bit_num+1]
-
-                con_string = &quot;{{ %s }}&quot; % context_name
-                template_string = &quot;%s%s%s&quot; % (''.join(self.loaded_classes), tag_string, con_string)
-                import ipdb; ipdb.set_trace()
+            out_context = {}
+            context_name = &quot;&quot;
+            #Try and find anything in the string that's in the context
+            context_name = ''
+            bits = tag_string.split()
+            for bit_num, bit in enumerate(bits):
                 try:
-                    template_obj = template.Template(template_string)
-                    rendered_string = template_obj.render(template.Context(out_context))
-                except Exception, e:
-                    print &quot;EXCEPTION: %s&quot; % e.message
-                #self.tests.append(rendered_string)
-                self.output_ttag(template_string, rendered_string, out_context)
+                    out_context[bit] = template.Variable(bit).resolve(self.context)
+                except:
+                    pass
+                if bit == 'as':
+                    context_name = bits[bit_num+1]
+
+            con_string = &quot;{{ %s }}&quot; % context_name
+            template_string = &quot;%s%s%s&quot; % (''.join(self.loaded_classes), tag_string, con_string)
+            try:
+                template_obj = template.Template(template_string)
+                rendered_string = template_obj.render(template.Context(out_context))
+            except Exception, e:
+                print &quot;EXCEPTION: %s&quot; % e.message
+            #self.tests.append(rendered_string)
+            self.output_ttag(template_string, rendered_string, out_context)
 
     def output_ttag(self, template_str, output_str, context):
-        log.info('''\t\ttmpl = template.Template(u&quot;&quot;&quot;%s&quot;&quot;&quot;)''' % template_str)
+        Testmaker.log.info('''        tmpl = template.Template(u&quot;&quot;&quot;%s&quot;&quot;&quot;)''' % template_str)
         context_str = &quot;{&quot;
         for con in context:
             try:
@@ -100,6 +107,5 @@ class TemplateParser(object):
                 pass
         context_str += &quot;}&quot;
 
-        log.info('''\t\tcontext = template.Context(%s)''' % context_str)
-        log.info('''\t\tself.assertEqual(tmpl.render(context), u&quot;&quot;&quot;%s&quot;&quot;&quot;)''' % output_str)
-
+        Testmaker.log.info('''        context = template.Context(%s)''' % context_str)
+        Testmaker.log.info('''        self.assertEqual(tmpl.render(context), u&quot;&quot;&quot;%s&quot;&quot;&quot;)''' % output_str)</diff>
      <filename>test_utils/templatetags/__init__.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f199bbb6f94846176601d9999664e990f8bb6330</id>
    </parent>
  </parents>
  <author>
    <name>Eric Holscher</name>
    <email>eric@ericholscher.com</email>
  </author>
  <url>http://github.com/ericholscher/django-test-utils/commit/43f78399991e0d839d527e69f3fd57b4cef7015a</url>
  <id>43f78399991e0d839d527e69f3fd57b4cef7015a</id>
  <committed-date>2009-08-27T23:03:38-07:00</committed-date>
  <authored-date>2009-08-27T23:03:38-07:00</authored-date>
  <message>Get template tag testmaker back into working shape of some kind.</message>
  <tree>cf966ed9aabba4d9b7b916833a628a63a6fe9110</tree>
  <committer>
    <name>Eric Holscher</name>
    <email>eric@ericholscher.com</email>
  </committer>
</commit>
