Skip to content

Commit

Permalink
Added a length implementation to pDocumentTemplate.
Browse files Browse the repository at this point in the history
  • Loading branch information
hathawsh committed Jun 21, 2001
1 parent c0a3894 commit 34bd60b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pDocumentTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
__doc__='''Python implementations of document template some features
$Id: pDocumentTemplate.py,v 1.30 2001/06/21 19:08:59 shane Exp $'''
__version__='$Revision: 1.30 $'[11:-2]
$Id: pDocumentTemplate.py,v 1.31 2001/06/21 19:43:44 shane Exp $'''
__version__='$Revision: 1.31 $'[11:-2]

import string, sys, types
from string import join
Expand Down Expand Up @@ -160,6 +160,9 @@ def __getitem__(self,key):
self.cache[key]=r
return r

def __len__(self):
return 1

class MultiMapping:

def __init__(self): self.dicts=[]
Expand Down Expand Up @@ -220,6 +223,12 @@ def __getitem__(self,key,call=1):
v = 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):
try:
v=self.dicts[key]
Expand Down

0 comments on commit 34bd60b

Please sign in to comment.