Commit 15fb2a96 authored by Shane Hathaway's avatar Shane Hathaway

Added a length implementation to pDocumentTemplate.

parent 00b45a25
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
__doc__='''Python implementations of document template some features __doc__='''Python implementations of document template some features
$Id: pDocumentTemplate.py,v 1.30 2001/06/21 19:08:59 shane Exp $''' $Id: pDocumentTemplate.py,v 1.31 2001/06/21 19:43:44 shane Exp $'''
__version__='$Revision: 1.30 $'[11:-2] __version__='$Revision: 1.31 $'[11:-2]
import string, sys, types import string, sys, types
from string import join from string import join
...@@ -160,6 +160,9 @@ class InstanceDict: ...@@ -160,6 +160,9 @@ class InstanceDict:
self.cache[key]=r self.cache[key]=r
return r return r
def __len__(self):
return 1
class MultiMapping: class MultiMapping:
def __init__(self): self.dicts=[] def __init__(self): self.dicts=[]
...@@ -220,6 +223,12 @@ class TemplateDict: ...@@ -220,6 +223,12 @@ class TemplateDict:
v = v() v = v()
return v return v
def __len__(self):
total = 0
for d in self.dicts.dicts:
total = total + len(d)
return total
def has_key(self,key): def has_key(self,key):
try: try:
v=self.dicts[key] v=self.dicts[key]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment