Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Andreas Jung



--On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] wrote:

I'm getting an AssertionError on this!!!
After having used objectValues() for so many many years without much
trouble my confidence in it just dropped.


After years of Zope, you know that we need a full traceback :-)

Andreas

pgplCurBNuW8z.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Peter Bengtsson
2008/7/3 Andreas Jung [EMAIL PROTECTED]:


 --On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] wrote:

 I'm getting an AssertionError on this!!!
 After having used objectValues() for so many many years without much
 trouble my confidence in it just dropped.

 After years of Zope, you know that we need a full traceback :-)


The traceback will just say that the AssertionError happened. It
doesn't mention anything interesting.

Traceback (innermost last):
  Module ZPublisher.Publish, line 101, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
   - __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
  Module 
/home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/wf_script_despatcher.py,
line 41, in workflowscripts2methods
AssertionError





-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Andrew Milton
+---[ Peter Bengtsson ]--
| 2008/7/3 Andreas Jung [EMAIL PROTECTED]:
| 
| 
|  --On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] wrote:
| 
|  I'm getting an AssertionError on this!!!
|  After having used objectValues() for so many many years without much
|  trouble my confidence in it just dropped.
| 
|  After years of Zope, you know that we need a full traceback :-)
| 
| 
| The traceback will just say that the AssertionError happened. It
| doesn't mention anything interesting.
| 
| Traceback (innermost last):
|   Module ZPublisher.Publish, line 101, in publish
|   Module ZPublisher.mapply, line 88, in mapply
|   Module ZPublisher.Publish, line 39, in call_object
|   Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
|- __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
|   Module 
/home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/wf_script_despatcher.py,
| line 41, in workflowscripts2methods
| AssertionError

It does tell you the script and the line of the External Method that is
causing the problem when being instanced via _getOb() (from
objectValues)


-- 
Andrew Milton
[EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Peter Bengtsson
2008/7/3 Andrew Milton [EMAIL PROTECTED]:
 +---[ Peter Bengtsson ]--
 | 2008/7/3 Andreas Jung [EMAIL PROTECTED]:
 | 
 | 
 |  --On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] 
 wrote:
 | 
 |  I'm getting an AssertionError on this!!!
 |  After having used objectValues() for so many many years without much
 |  trouble my confidence in it just dropped.
 | 
 |  After years of Zope, you know that we need a full traceback :-)
 | 
 |
 | The traceback will just say that the AssertionError happened. It
 | doesn't mention anything interesting.
 |
 | Traceback (innermost last):
 |   Module ZPublisher.Publish, line 101, in publish
 |   Module ZPublisher.mapply, line 88, in mapply
 |   Module ZPublisher.Publish, line 39, in call_object
 |   Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
 |- __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
 |   Module 
 /home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/wf_script_despatcher.py,
 | line 41, in workflowscripts2methods
 | AssertionError

 It does tell you the script and the line of the External Method that is
 causing the problem when being instanced via _getOb() (from
 objectValues)

I know. That was the script I showed and the code only has one obvious
assert statement. That was my code the assert statement. The point is,
it shouldn't happen, ever.



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Andreas Jung



--On 3. Juli 2008 16:01:53 +0100 Peter Bengtsson [EMAIL PROTECTED] wrote:


2008/7/3 Andreas Jung [EMAIL PROTECTED]:



--On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED]
wrote:


I'm getting an AssertionError on this!!!
After having used objectValues() for so many many years without much
trouble my confidence in it just dropped.


After years of Zope, you know that we need a full traceback :-)



The traceback will just say that the AssertionError happened. It
doesn't mention anything interesting.

Traceback (innermost last):
  Module ZPublisher.Publish, line 101, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
   - __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
  Module
/home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/
wf_script_despatcher.py, line 41, in workflowscripts2methods
AssertionError


Peter, you know that you can look at the code and check what's going on :-)


Andreas

pgpyua5i8WtfV.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Andrew Milton
+---[ Peter Bengtsson ]--
| 2008/7/3 Andrew Milton [EMAIL PROTECTED]:
|  +---[ Peter Bengtsson ]--
|  | 2008/7/3 Andreas Jung [EMAIL PROTECTED]:
|  | 
|  | 
|  |  --On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] 
wrote:
|  | 
|  |  I'm getting an AssertionError on this!!!
|  |  After having used objectValues() for so many many years without much
|  |  trouble my confidence in it just dropped.
|  | 
|  |  After years of Zope, you know that we need a full traceback :-)
|  | 
|  |
|  | The traceback will just say that the AssertionError happened. It
|  | doesn't mention anything interesting.
|  |
|  | Traceback (innermost last):
|  |   Module ZPublisher.Publish, line 101, in publish
|  |   Module ZPublisher.mapply, line 88, in mapply
|  |   Module ZPublisher.Publish, line 39, in call_object
|  |   Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
|  |- __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
|  |   Module 
/home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/wf_script_despatcher.py,
|  | line 41, in workflowscripts2methods
|  | AssertionError
| 
|  It does tell you the script and the line of the External Method that is
|  causing the problem when being instanced via _getOb() (from
|  objectValues)
| 
| I know. That was the script I showed and the code only has one obvious
| assert statement. That was my code the assert statement. The point is,
| it shouldn't happen, ever.

Except CMFSite is calling it according to your traceback..


-- 
Andrew Milton
[EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Peter Bengtsson
2008/7/3 Andrew Milton [EMAIL PROTECTED]:
 +---[ Peter Bengtsson ]--
 | 2008/7/3 Andrew Milton [EMAIL PROTECTED]:
 |  +---[ Peter Bengtsson ]--
 |  | 2008/7/3 Andreas Jung [EMAIL PROTECTED]:
 |  | 
 |  | 
 |  |  --On 3. Juli 2008 15:41:52 +0100 Peter Bengtsson [EMAIL PROTECTED] 
 wrote:
 |  | 
 |  |  I'm getting an AssertionError on this!!!
 |  |  After having used objectValues() for so many many years without much
 |  |  trouble my confidence in it just dropped.
 |  | 
 |  |  After years of Zope, you know that we need a full traceback :-)
 |  | 
 |  |
 |  | The traceback will just say that the AssertionError happened. It
 |  | doesn't mention anything interesting.
 |  |
 |  | Traceback (innermost last):
 |  |   Module ZPublisher.Publish, line 101, in publish
 |  |   Module ZPublisher.mapply, line 88, in mapply
 |  |   Module ZPublisher.Publish, line 39, in call_object
 |  |   Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
 |  |- __traceback_info__: ((CMFSite instance at 9b924a0,), {}, None)
 |  |   Module 
 /home/peterbe/virtualenvzope/Gosh/zope278/Products/SeamusCore/Extensions/wf_script_despatcher.py,
 |  | line 41, in workflowscripts2methods
 |  | AssertionError
 | 
 |  It does tell you the script and the line of the External Method that is
 |  causing the problem when being instanced via _getOb() (from
 |  objectValues)
 | 
 | I know. That was the script I showed and the code only has one obvious
 | assert statement. That was my code the assert statement. The point is,
 | it shouldn't happen, ever.

 Except CMFSite is calling it according to your traceback..


CMFSite is the type of the container that holds the External Method
that runs that stuff.

-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Annoying when objectValues() doesn't work

2008-07-03 Thread Dieter Maurer
Peter Bengtsson wrote at 2008-7-3 15:41 +0100:
from cStringIO import StringIO

def workflowscripts2methods(self):
out = StringIO()

print out, Star converting workflow scripts into External Methods

pw = self.portal_workflow
for workflow in pw.objectValues('Workflow'):
for container in workflow.objectValues('Workflow Scripts'):
meta_type = 'Script (Python)'
for script in container.objectValues(meta_type):
assert script.meta_type == meta_type
print out, script (%r, %s) % (script.meta_type,
script.absolute_url_path())


value = out.getvalue()
print value
return value


I'm getting an AssertionError on this!!!

For efficiency reasons, a Folder maintains the meta types
used for filtering object* in a separate structure (this is
the _objects attribute for normal folders).

Your AssertionError indicates that this structure is inconsistent
with the true objects.

As long as a folder is only modified by the official Folder
api (_setObject, _delObject and higher level functions),
consistency is garanteed. However, lower level functions
can destroy the consistency.

It is not a problem with objectValues. The problem
must be elsewhere.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )