David Ford <[EMAIL PROTECTED]> wrote:

> i have tmda 1.1.8 running on my system fine.  i have a problem getting
> the cgi to run now.  any comments?

<snip>

I think the attached patch may fix it.  Please give it a try and let me
know.  Hopefully it doesn't break anything new :)

To apply the patch, go into the tmda-cgi directory and run:

  patch -p0 < template_unicode.patch

-- 
Jim Ramsay
"Me fail English?  That's unpossible!"
Index: Template.py
===================================================================
--- Template.py	(revision 2091)
+++ Template.py	(working copy)
@@ -184,18 +184,18 @@
 
     RetVal = ""
     for HTML in self.HTML:
-      if type(HTML) == StringType:
+      if isinstance(HTML, Template):
+        RetVal += str(HTML)
+      else:
         if self.BeenExpanded:
           RetVal += HTML
         else:
           RetVal += self.LonePctSearch.sub(self.LonePctRepl, HTML) % self.Dict
-      else:
-        RetVal += str(HTML)
     return RetVal
 
   def UpdateItems(self, Target):
     for i in range(len(self.HTML)):
-      if type(self.HTML[i]) != StringType:
+      if isinstance(self.HTML[i], Template):
         if self.HTML[i].Name:
           self.HTML[i].BoilerPlate.UpdateItems(self.HTML[i])
           Target.Items[self.HTML[i].Name] = self.HTML[i]
@@ -215,7 +215,12 @@
 
     # Find the start tag
     for i in range(len(self.HTML)):
-      if type(self.HTML[i]) == StringType:
+      if isinstance(self.HTML[i], Template):
+        RetVal = self.HTML[i][Var]
+        if RetVal:
+          self.UpdateItems(self)
+          return RetVal
+      else:
         Match = self.SearchDict[Var].search(self.HTML[i])
         if Match:
           # Is it an all-in-one tag?
@@ -230,7 +235,7 @@
               [self.HTML[i][:Match.start()], self.HTML[i][Match.end():]]
             # Now search for the end tag
             for j in range(i+1, len(self.HTML)):
-              if type(self.HTML[j]) == StringType:
+              if not isinstance(self.HTML[j], Template):
                 Match = self.VarEndSearch.search(self.HTML[j])
                 if Match:
                   # Found end tag, split off text after it
@@ -244,22 +249,17 @@
                   self.UpdateItems(self)
                   return self.HTML[i+1]
           raise KeyError, "Can't find end tag for variable: %s" % Var
-      else:
-        RetVal = self.HTML[i][Var]
-        if RetVal:
-          self.UpdateItems(self)
-          return RetVal
     return None
 
   def Expand(self, Dict):
     "Expand any %(<name>)s references in self."
     for i in range(len(self.HTML)):
-      if type(self.HTML[i]) == StringType:
+      if isinstance(self.HTML[i], Template):
+        self.HTML[i].Expand(Dict)
+      else:
         if not self.BeenExpanded:
           self.HTML[i] = \
             self.LonePctSearch.sub(self.LonePctRepl, self.HTML[i]) % Dict
-      else:
-        self.HTML[i].Expand(Dict)
     self.BeenExpanded = 1
     return self
 
_____________________________________________
tmda-users mailing list (tmda-users@tmda.net)
http://tmda.net/lists/listinfo/tmda-users

Reply via email to