[Zope-dev] Squish
Chris Withers
chrisw@nipltd.com
Mon, 21 Aug 2000 15:00:43 +0100
...it was named appropriately ;-)
Right, this would probably be easier if you have a background knowledge
of Confera/Squishdot code, anyway...
there's two classes, SquishSite and Posting. They don't inherit from
each other, but postings are always contained in a SquishSite and
eveything is Acquisition.Implicit-inheriting.
Right, there's a whole host of methods:
def postingValues(self):
def tpId(self):
def tpURL(self):
def this(self): return self
def has_items(self):
def desc_items(self):
...that are implemented identically. So I thought 'why?' Why can't they
just be implemented in the SquishSite class and acquired by the
postings?
So I commented them out... bad move :( Things that used desc_items, and
a dtml-tree that used postingValues suddenly started producing infinite
recusion errors and other weirdness. I think, instead of returning the
children like postingValues is supposed to, it just returned the
children of the Site object instead. very strange. Can you help explain?
(it seemed to me like the method was being acquired alright, but the
'self' being used was that of the object the method was acquired from
rather than object the method was being called on)
The code for the two methods of any substance (the rest are just things
like 'return self' and 'return self.id') is shown below.
cheers,
Chris
# protected by 'View' permission
def desc_items(self):
# """ return latest list of replies """
mlist = []
mstack = Stack()
if self.has_items():
plist = []
for id in self.ids:
plist.append(id)
plist.reverse()
for id in plist:
mstack.push(id)
while not mstack.isEmpty():
item_id = mstack.pop()
item = self.data[item_id]
mlist.append(item)
if item.has_items():
plist = []
for id in item.ids:
plist.append(id)
plist.reverse()
for id in plist:
mstack.push(id)
return map((lambda x, p=self: x.__of__(p)), mlist)
# protected by 'Manage Postings' permission
def postingValues(self):
# """ return all replies """
return map(lambda x, p=self: x.__of__(p),
self.data.map(self.ids))
self.data is an IOBtree in the SquishSite object.
self.ids is an intSet in the SquishSite object.
(I think both are acquired by Posting objects)