I have two nice methods.  One of them (methodA) is called via the web.
These belong to one class; classA.

class classA:
    "doc string"

    def methodA(self):
        "doc string"
        objects = self.methodB(self)

        attrib = ''     

        for object in objects:
                attrib = attrib + 'some html'

        return attrib

    def methodB(self, object, skip=[], stop=[], objects=[]):
        "doc string"    
            if object.meta_type in skip:
                return self.methodB(object.getParentNode(), skip,
                                    stop, objects)

            if object.meta_type in stop:
                raise AttributeError
                # I don't think I need this.
                if object not in objects:
                    raise AttributeError
                return self.methodB(object.getParentNode(), skip,
                                    stop, objects)
        except AttributeError:
                return objects

Narrative story: The user calls methodA (from a instance of
classA) through the web.  methodA returns some nicely formatted HTML
navigation links.  methodB should traverse through the objects with
getParentNode(), append the object in the list objects (if its meta_type
is not listed in 'skip' or 'stop' - which are "skip meta_types" and
"stop_meta_types" lists) and return them to methodA for formatting.  The
objects should be listed in the list that is returned sequentially and
methodA would be required to do an objects.reverse() to make sure we are
facing the right direction.

First of all, this doesn't work very nicely.  Every other time I refresh
my webpage (ie. call methodA) it seems to reverse() the list returned
from methodB on its own.  That's strange.  This results in:

        [<instance1>, <instance2>]


        [<instance2>, <instance1>]

every other time.  *baffled*

Now comes the part which really makes me want to go to my hotelroom and
watch Life of Brian on BBC at 9.00pm; if I refresh the webpage quickly,
and many times (not too quick or too many times; 2-5 times within 2-5
seconds) I get a ConflictError raised in my log - it doesn't take it up to
the webpage.  There is other stuff going on which causes the ConflictError
to get raised (although, I'm only _reading_ from a ZCatalog, as far as I
know anyway).

Heres what I don't understand.  When ever I get a ConflictError, the
contents of the 'objects' attribute in methodB isn't "flushed".  Thus,
resulting in a very long navigation bar with repeating links.  Let me
repeat that: The attribute 'objects' of the method methodB appears to be

Which it isn't of course.

My best guess is that something is wrong with the logic when a
ConflictError is raised.  It would make kinda sense.

Tracebacks, beers or other interesting things offered if needed. :)

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to