[Zope-CMF] CMFCatalogAware.dispatchToOpaqueItems madness

2008-12-19 Thread Matt Hamilton
I really don't understand this code, so maybe I'm missing something here, but
anyone know wtf the opaqueItem code does in CMFCore.CMFCatalogAware?!

Why does the opaqueItems method iterate through *every* attribute in the root of
the site causing all objects (including, at least in plone) all sub-objects of
folders to be woken up too):

for name in self_base.__dict__.keys():
obj = getattr(self, name)
if ICallableOpaqueItem.providedBy(obj) \
or z2ICallableOpaqueItem.isImplementedBy(obj):
items.append((obj.getId(), obj))

If it is looking for opaque items (I still don't know what these really are)
then why does it look in content objects too?!

How about the changes below?

objectids = dict([(x,1) for x in self.objectIds()])
 
for name in self_base.__dict__.keys():
if name not in objectids:  
 
obj = getattr(self, name)
if ICallableOpaqueItem.providedBy(obj) \
or z2ICallableOpaqueItem.isImplementedBy(obj):
items.append((obj.getId(), obj))

(that was probably all wrapped to hell)

Basically, I've got a production site which loads up several tens of thousands
of objects from the ZODB just to display the front page.  Madness.

-Matt

-- 
Matt Hamilton   ma...@netsight.co.uk
Netsight Internet Solutions, Ltd.   Understand. Develop. Deliver
http://www.netsight.co.uk +44 (0)117 9090901
Web Design | Zope/Plone Development  Consulting | Co-location | Hosting

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] CMFCatalogAware.dispatchToOpaqueItems madness

2008-12-19 Thread Matt Hamilton
Matt Hamilton ma...@... writes:

 
 I really don't understand this code, so maybe I'm missing something here, but
 anyone know wtf the opaqueItem code does in CMFCore.CMFCatalogAware?!
 
 Why does the opaqueItems method iterate through *every* attribute in the root
 of the site causing all objects (including, at least in plone) all sub-objects
 of folders to be woken up too):

Of course as soon as you find the problem, you then know how to ask the
question... and in looking for opaqueitems, found that Helge has already got
there and started waving some performance pixie dust over it:

http://pypi.python.org/pypi/experimental.opaquespeedup

Still... I don't quite understand why CMF is doing what it is doing in the first
place.

-Matt

-- 
Matt Hamilton   ma...@netsight.co.uk
Netsight Internet Solutions, Ltd.   Understand. Develop. Deliver
http://www.netsight.co.uk +44 (0)117 9090901
Web Design | Zope/Plone Development  Consulting | Co-location | Hosting



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] CMFCatalogAware.dispatchToOpaqueItems madness

2008-12-19 Thread Charlie Clark

Am 19.12.2008 um 10:48 schrieb Matt Hamilton:

 Of course as soon as you find the problem, you then know how to ask  
 the
 question...

I think that sense of embarassment is an essential part of the  
solution! ;-)

 and in looking for opaqueitems, found that Helge has already got
 there and started waving some performance pixie dust over it:

 http://pypi.python.org/pypi/experimental.opaquespeedup

 Still... I don't quite understand why CMF is doing what it is doing  
 in the first
 place.


They are containers which won't be picked up by the normal methods. I  
agree that the current practice of checking every attribute could be a  
little expensive if you have lots of child objects stored in  
attributes. I think the solution is probably to see if the problem  
that they were introduced to address can't be solved in a different  
manner. The discussion a couple of weeks ago about CMFCatalogAware  
suggested that this class does indeed need refactoring for more  
predictable behaviour.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] Charsets

2008-12-19 Thread Charlie Clark

Am 15.12.2008 um 21:01 schrieb Dieter Maurer:

 It is usually insane to use client preferences to guess the encoding
 used in form data.

Have to agree with you there.

 Usually, the client will use the charset it has found in the
 page containing the form. Thus, unless this charset has been
 determined automatically from the Accept-Charset header,
 it is merely accidental when the client preferences (Accept-Charset)
 is able to guess the charset correctly.


Right. So I must be doing something wrong if all Zope has to go on for  
decoding the form is the Accept-Charset? How can I set an encoding for  
the form?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] CMFCatalogAware.dispatchToOpaqueItems madness

2008-12-19 Thread Matt Hamilton
Charlie Clark char...@... writes:

 
 
 Am 19.12.2008 um 10:48 schrieb Matt Hamilton:
 
  Of course as soon as you find the problem, you then know how to ask  
  the
  question...
 
 I think that sense of embarassment is an essential part of the  
 solution! 

Indeed ;)

  and in looking for opaqueitems, found that Helge has already got
  there and started waving some performance pixie dust over it:
 
  http://pypi.python.org/pypi/experimental.opaquespeedup
 
  Still... I don't quite understand why CMF is doing what it is doing  
  in the first
  place.
 
 They are containers which won't be picked up by the normal methods. I  
 agree that the current practice of checking every attribute could be a  
 little expensive if you have lots of child objects stored in  
 attributes. I think the solution is probably to see if the problem  
 that they were introduced to address can't be solved in a different  
 manner. The discussion a couple of weeks ago about CMFCatalogAware  
 suggested that this class does indeed need refactoring for more  
 predictable behaviour.

The issue is it's not just finding the opaque objects but waking up all the
'normal' objects too.  Hence it is looking in folders (which would already get
the event no doubt).  I suppose the bit that really confuses me is why is a
BeforeTraverse event being handled and dispatched to these opaque objects by
code in CMFCatalogAware?  My first thoughts when looking at the tracebacks in
pdb went something like 'OK I'm traversing, so a traversal event is fired...
wait a sec, why is CMFCatalogAware code being executed... I'm not indexing
anything... wtf?!'.

-Matt

-- 
Matt Hamilton   ma...@netsight.co.uk 
Netsight Internet Solutions, Ltd.   Understand. Develop. Deliver
http://www.netsight.co.uk +44 (0)117 9090901
Web Design | Zope/Plone Development  Consulting | Co-location | Hosting



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


[Zope-CMF] CMF Tests: 6 OK

2008-12-19 Thread CMF Tests Summarizer
Summary of messages to the cmf-tests list.
Period Thu Dec 18 12:00:00 2008 UTC to Fri Dec 19 12:00:00 2008 UTC.
There were 6 messages: 6 from CMF Tests.


Tests passed OK
---

Subject: OK : CMF-2.1 Zope-2.10 Python-2.4.5 : Linux
From: CMF Tests
Date: Thu Dec 18 20:56:23 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010573.html

Subject: OK : CMF-2.1 Zope-2.11 Python-2.4.5 : Linux
From: CMF Tests
Date: Thu Dec 18 20:57:53 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010574.html

Subject: OK : CMF-trunk Zope-2.10 Python-2.4.5 : Linux
From: CMF Tests
Date: Thu Dec 18 20:59:23 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010575.html

Subject: OK : CMF-trunk Zope-2.11 Python-2.4.5 : Linux
From: CMF Tests
Date: Thu Dec 18 21:00:53 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010576.html

Subject: OK : CMF-trunk Zope-trunk Python-2.4.5 : Linux
From: CMF Tests
Date: Thu Dec 18 21:02:23 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010577.html

Subject: OK : CMF-trunk Zope-trunk Python-2.5.2 : Linux
From: CMF Tests
Date: Thu Dec 18 21:03:53 EST 2008
URL: http://mail.zope.org/pipermail/cmf-tests/2008-December/010578.html

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] Charsets

2008-12-19 Thread Dieter Maurer
Charlie Clark wrote at 2008-12-19 11:35 +0100:
 ...
 Usually, the client will use the charset it has found in the
 page containing the form. Thus, unless this charset has been
 determined automatically from the Accept-Charset header,
 it is merely accidental when the client preferences (Accept-Charset)
 is able to guess the charset correctly.


Right. So I must be doing something wrong if all Zope has to go on for  
decoding the form is the Accept-Charset? How can I set an encoding for  
the form?

The site should deliver all pages containing forms (if possible even
all pages) with a single charset, let's call it the site charset.
Then it uses this same charset to interpret form data.



-- 
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests