All of a sudden ZDiscussions fails. The version we've been using (heavily modified to change its skin) is venerable -- old enough that I cannot find the version number. I know there is a new version (python and ZPT based), but we are in a time crunch and would like to avoid having to modify the new version quickly. So -- can anyone suggest a simple workaround. We don't want to back up Zope versions since most everything else has been moved forward to 2.6.2. The problem we encounter is an exception that states that an attribute is not found in Lazy Map Instance. ZDiscussions is a hybrid python (ZBase)/ZClass product. The missing attributes are in the ZBase product, but are not found. We did run 2.6.1 for a bit, but moved to 2.6.2 when it became available to avoid some stability problems. The ZDiscussion product worked (I think) in the 2.6.1. It certainly worked and worked well in 2.5.1. TIA for any help... -dra
Dennis Allison wrote:
The problem we encounter is an exception that states that an attribute is not found in Lazy Map Instance. ZDiscussions is a hybrid python (ZBase)/ZClass product. The missing attributes are in the ZBase product, but are not found.
The exception type, value and traceback would help... Chris
Error Type: AttributeError Error Value: LazyMap instance has no attribute 'threadMessageCount' Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module OFS.DTMLMethod, line 126, in __call__ Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_In, line 604, in renderwb Module DocumentTemplate.DT_Util, line 201, in eval - __traceback_info__: id Module <string>, line 2, in f Module AccessControl.DTML, line 29, in guarded_getattr Module AccessControl.ZopeGuards, line 47, in guarded_getattr AttributeError: LazyMap instance has no attribute 'threadMessageCount' But -- threadMessageCount is defined and present in the ZBase product which is installed. the system has worked under Zope 2.5.1 and has been failing under 2.6.2b3. No changes since that point. Code is identical and security settings are the same. I am not sure about ownership but will check. This version of ZDiscussions is a mixed python and ZClass product. On Fri, 18 Jul 2003, Chris Withers wrote:
Dennis Allison wrote:
The problem we encounter is an exception that states that an attribute is not found in Lazy Map Instance. ZDiscussions is a hybrid python (ZBase)/ZClass product. The missing attributes are in the ZBase product, but are not found.
The exception type, value and traceback would help...
Chris
Dennis Allison wrote at 2003-7-18 08:08 -0700:
.... Error Type: AttributeError Error Value: LazyMap instance has no attribute 'threadMessageCount'
Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module OFS.DTMLMethod, line 126, in __call__ Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_In, line 604, in renderwb Module DocumentTemplate.DT_Util, line 201, in eval - __traceback_info__: id Module <string>, line 2, in f Module AccessControl.DTML, line 29, in guarded_getattr Module AccessControl.ZopeGuards, line 47, in guarded_getattr AttributeError: LazyMap instance has no attribute 'threadMessageCount'
It seems that your DTMLMethod performs a catalog query (this returns a "LazyMap" instance) and tries to access the "threadMessageCount" attribute on it. Of course, this will not work. Almost surely, you need to access a single hit (this is a BrainObject), then call its method "getObject" (to get the true object) and only then access "threadMessageCount". Dieter
Dieter, I've moved on to the new TAL/Python version of ZUBB which looks like it will do just fine. We need to make some mods to give the functionality we had in the ZDiscussions product, but it looks like it's not overmuch work. The problem we encountered is with the old product. The diagnostic came from the access to _[id].threadMessageCount() near the end of the code snippet below. This portion of the code is pure vanilla, exactly as distributed as ZDiscussions and has been working for ages. Zope 2.6.2b3 appears to break it. Is this a bug? or a feature? Presumably Zope 2.5.1 was able to do a getObject() as needed. Anyhow, the immediate problem has been resolved by moving to a new version of the same product (if rebuilding from the ground floor counts as a revision).. But there remains the question as to why one Zope runs the code and a later one does not. [snip] <dtml-var standard_html_header> <dtml-call expr="debugWindow(id)"> <dtml-unless batch_size> <dtml-call "REQUEST.set('batch_size',20)"> </dtml-unless> <dtml-in "searchResults(in_reply_to=[''])" size=batch_size reverse sort=id start=query_start> <dtml-if sequence-start> <dtml-if "AUTHENTICATED_USER.has_permission('Delete objects', '')"> <form action="" method="get"> </dtml-if> <!-- main table --> <table class="content"> <tr> <td> </td> <td align="left" valign="middle" class="tablehead">Subject</td> <td valign="middle" class="tablehead">Author</td> <td valign="middle" class="tablehead">Posts</td> <td valign="middle" class="tablehead">Posted</td> <td valign="middle" class="tablehead">Last Post</td> </tr> </dtml-if> <tr class="<dtml-if sequence-even>zubbrownormal<dtml-else>zubbrowhilite</dtml-if>"> <td align="center" valign="middle"> <dtml-if "AUTHENTICATED_USER.has_permission('Delete objects', '')"> <input type="checkbox" name="ids" value="<dtml-var id>" /> <dtml-else> <a href="<dtml-var id>"><img src="<dtml-var absolute_url>/icon_folder" width="14" height="12" border="0"></a> </dtml-if> </td> <td class="tabledata" align="left" valign="middle"><a class="tablehead" href="<dtml-var id>"><dtml-if "title==''">(no subject)<dtml-else><dtml-var title html_quote size="30" missing="subject"></dtml-if></a></td> <td class="tabledata"><dtml-if "author==''">Anonymous<dtml-else><dtml-var author html_quote size="30" missing="Anonymous"></dtml-if></td> <td class="tabledata" valign="middle"><dtml-var "_[id].threadMessageCount()"></td> <td class="tabledata" valign="middle"><dtml-var created fmt="%m/%d/%y"></td> <td class="tabledata" valign="middle"><dtml-var "_[id].threadNewestMessageDate()" fmt="%m/%d/%y"></td> </tr> <dtml-if sequence-end> [snip] On Fri, 18 Jul 2003, Dieter Maurer wrote:
Dennis Allison wrote at 2003-7-18 08:08 -0700:
.... Error Type: AttributeError Error Value: LazyMap instance has no attribute 'threadMessageCount'
Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module OFS.DTMLMethod, line 126, in __call__ Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_In, line 604, in renderwb Module DocumentTemplate.DT_Util, line 201, in eval - __traceback_info__: id Module <string>, line 2, in f Module AccessControl.DTML, line 29, in guarded_getattr Module AccessControl.ZopeGuards, line 47, in guarded_getattr AttributeError: LazyMap instance has no attribute 'threadMessageCount'
It seems that your DTMLMethod performs a catalog query (this returns a "LazyMap" instance) and tries to access the "threadMessageCount" attribute on it.
Of course, this will not work. Almost surely, you need to access a single hit (this is a BrainObject), then call its method "getObject" (to get the true object) and only then access "threadMessageCount".
Dieter
Dennis Allison wrote at 2003-7-18 12:51 -0700:
... The problem we encountered is with the old product. The diagnostic came from the access to _[id].threadMessageCount() near the end of the code snippet below. This portion of the code is pure vanilla, exactly as distributed as ZDiscussions and has been working for ages. Zope 2.6.2b3 appears to break it. Is this a bug? or a feature? Presumably Zope 2.5.1 was able to do a getObject() as needed.
It looks as if "id" would reference a catalog rather then a discussion object. Such things can happen due to the sometimes unstable behaviour of acquisition and (even more) DTML namespaces. Dieter
Dieter Maurer wrote:
Of course, this will not work. Almost surely, you need to access a single hit (this is a BrainObject), then call its method "getObject" (to get the true object) and only then access "threadMessageCount".
...or add threadMessageCount as a piece of metadat on the ZCatalog... cheers, Chris
participants (3)
-
Chris Withers -
Dennis Allison -
Dieter Maurer