Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-21 Thread Gary Poster


On Mar 20, 2006, at 5:58 PM, Tom Dossis wrote:


Tom Dossis wrote:

Gary Poster wrote:


Use the ones in zc.catalog.catalogindex.py instead: they do the   
necessary mixing-in for zope.app.catalog friendliness, without a  
patch.

Looks like I missed it - thank you.
The purpose of the patch was to convert documentCount  workCount  
to methods for the advanced view.

I'll try it out.


Turns out I was using zc.catatlog.catalogindex.SetIndex and the  
patch was to convert the above attributes to methods.  From memory  
they were showing up as repr's in the advanced catalog page.  Maybe  
there was a way to achieve this via zcml?


Just looked into this.  They are not methods, they are callables:  
BTrees.Length.Length objects return their values when called.  The  
indexes comply with the zope.index interfaces, and in fact are tested  
to do so.  That said, you and Thierry are quite right that they do  
not display correctly in the advanced catalog view.  We don't use it,  
so I didn't care.


I just added the necessary security declarations to make this work.   
Unfortunately I had to reach out of the package to make a security  
declaration on BTrees.Length.Length.__call__; this is a bit ugly, and  
ideally we'd address this sometime.


svn up to get the necessary changes.

Gary


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-21 Thread Gary Poster


On Mar 20, 2006, at 6:51 PM, Thierry FLORAC wrote:


On Mon, 2006-03-20 at 17:37 -0500, Gary Poster wrote:

On Mar 20, 2006, at 5:14 PM, Thierry FLORAC wrote:

But I'm just trying to use a simple (not subclassed) SetIndex, and
then to access my catalog Advanced management page...!
I don't build any specific template for this.

Should I build any specific SetIndex subclass ? Or define a specific
template ??


[...]


Modification is OK (at first, see below) for the first indexes, but an
error is raised while starting Zope for the DateTime indexes, because
class attribute points to a method name :

zope.configuration.config.ConfigurationExecutionError:
exceptions.TypeError: type_ must be a type, class or  
module, not

a function DateTimeValueIndex at 0xb672510c in:
File
/usr/local/zope/3.2/var/lib/python/zc/catalog/ 
configure.zcml,

line 58.3-66.3
 content class=.catalogindex.DateTimeValueIndex
   require
   permission=zope.ManageServices

interface=zope.app.catalog.interfaces.IAttributeIndex
  zope.index.interfaces.IStatistics
 

set_schema=zope.app.catalog.interfaces.IAttributeIndex
   /
 /content


Ah yes, my recommendation was made too quickly.  The last two should  
not have been there.  This third stanza would do the trick.


   content class=.catalogindex.NormalizationWrapper
 require
 permission=zope.ManageServices
 interface=zope.app.catalog.interfaces.IAttributeIndex
zope.index.interfaces.IStatistics
 set_schema=zope.app.catalog.interfaces.IAttributeIndex
 /
   /content

I made this change in svn.

After removing this modification for the two last indexes, I can  
access
catalog's advanced management screen without error, but  
information is
not really fine : on a SetIndex for example, Document Count and  
Word
Count columns are displayed as security proxied  
BTrees.Length.Length

instance at 0xb4dc052c instead of their numeric values...


Right, then it needed a declaration for  
BTrees.Length.Length.__call__.  This is in svn now too.


Try getting rid of your changes and getting the new version from  
svn.  It should do what you want.


Gary
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Stephan Richter
On Wednesday 15 March 2006 17:45, Thierry FLORAC wrote:
         TraversalError: (zc.catalog.catalogindex.SetIndex object at
 0xb46bfd2c, 'documentCount')


 documentCount seems to be defined into the SetIndex class, so I
 don't understand this error...

Well, by default attributes are not traversable, so that the following does 
not work:

object/attrname

But this should work:

object/++attribute++attrname

SchoolTool has developed a clever dynamic Traversal mechanism that allows you 
to do the first case:

http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/traverser/

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Thierry FLORAC
On Mon, 2006-03-20 at 10:16 -0500, Stephan Richter wrote:
 On Wednesday 15 March 2006 17:45, Thierry FLORAC wrote:
  TraversalError: (zc.catalog.catalogindex.SetIndex object at
  0xb46bfd2c, 'documentCount')
 
 
  documentCount seems to be defined into the SetIndex class, so I
  don't understand this error...
 
 Well, by default attributes are not traversable, so that the following does 
 not work:
 
 object/attrname
 
 But this should work:
 
 object/++attribute++attrname
 
 SchoolTool has developed a clever dynamic Traversal mechanism that allows you 
 to do the first case:
 
 http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/traverser/

But I'm just trying to use a simple (not subclassed) SetIndex, and
then to access my catalog Advanced management page...!
I don't build any specific template for this.

Should I build any specific SetIndex subclass ? Or define a specific
template ??

Thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Stephan Richter
On Monday 20 March 2006 17:14, Thierry FLORAC wrote:
 Should I build any specific SetIndex subclass ? Or define a specific
 template ??

I think in this case it is a bug. Feel free to report it in the issue 
tracker. :-)

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Tom Dossis

Thierry FLORAC wrote:


Should I build any specific SetIndex subclass ? Or define a specific
template ??



When I last used SetIndex from zc.catalog.index it didn't quite match 
the interface(s) required zope.app.catalog.  It was simple enough to 
patch - which I can send you if you like.

-Tom
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Gary Poster


On Mar 20, 2006, at 5:32 PM, Stephan Richter wrote:


On Monday 20 March 2006 17:14, Thierry FLORAC wrote:

Should I build any specific SetIndex subclass ? Or define a specific
template ??


I think in this case it is a bug. Feel free to report it in the issue
tracker. :-)


See email I just sent to Thierry.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Gary Poster


On Mar 20, 2006, at 5:34 PM, Tom Dossis wrote:


Thierry FLORAC wrote:

Should I build any specific SetIndex subclass ? Or define a specific
template ??


When I last used SetIndex from zc.catalog.index it didn't quite  
match the interface(s) required zope.app.catalog.  It was simple  
enough to patch - which I can send you if you like.


Use the ones in zc.catalog.catalogindex.py instead: they do the  
necessary mixing-in for zope.app.catalog friendliness, without a patch.


Gary
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Tom Dossis

Gary Poster wrote:


On Mar 20, 2006, at 5:34 PM, Tom Dossis wrote:


Thierry FLORAC wrote:

Should I build any specific SetIndex subclass ? Or define a specific
template ??


When I last used SetIndex from zc.catalog.index it didn't quite  match 
the interface(s) required zope.app.catalog.  It was simple  enough to 
patch - which I can send you if you like.


Use the ones in zc.catalog.catalogindex.py instead: they do the  
necessary mixing-in for zope.app.catalog friendliness, without a patch.


Looks like I missed it - thank you.
The purpose of the patch was to convert documentCount  workCount to 
methods for the advanced view.

I'll try it out.

-Tom
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Tom Dossis

Tom Dossis wrote:

Gary Poster wrote:


Use the ones in zc.catalog.catalogindex.py instead: they do the  
necessary mixing-in for zope.app.catalog friendliness, without a patch.


Looks like I missed it - thank you.
The purpose of the patch was to convert documentCount  workCount to 
methods for the advanced view.

I'll try it out.



Turns out I was using zc.catatlog.catalogindex.SetIndex and the patch 
was to convert the above attributes to methods.  From memory they were 
showing up as repr's in the advanced catalog page.  Maybe there was a 
way to achieve this via zcml?

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Thierry FLORAC
On Mon, 2006-03-20 at 17:37 -0500, Gary Poster wrote:
 On Mar 20, 2006, at 5:14 PM, Thierry FLORAC wrote:
  But I'm just trying to use a simple (not subclassed) SetIndex, and
  then to access my catalog Advanced management page...!
  I don't build any specific template for this.
 
  Should I build any specific SetIndex subclass ? Or define a specific
  template ??
 
 Thierry, try adding the following to zc.catalog's configure.zcml  
 (this is for all four of the zope.app.catalog-aware indexes).
 
content class=.catalogindex.ValueIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.SetIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.DateTimeValueIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.DateTimeSetIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
 
 Then give it a try.  (This only works if you are using the indexes I  
 listed, but you probably get the idea.)  If this helps, we should  
 check it in.

Modification is OK (at first, see below) for the first indexes, but an
error is raised while starting Zope for the DateTime indexes, because
class attribute points to a method name :

zope.configuration.config.ConfigurationExecutionError:
exceptions.TypeError: type_ must be a type, class or module, not
a function DateTimeValueIndex at 0xb672510c in:
File
/usr/local/zope/3.2/var/lib/python/zc/catalog/configure.zcml,
line 58.3-66.3
 content class=.catalogindex.DateTimeValueIndex
   require
   permission=zope.ManageServices

interface=zope.app.catalog.interfaces.IAttributeIndex
  zope.index.interfaces.IStatistics
 

set_schema=zope.app.catalog.interfaces.IAttributeIndex
   /
 /content

After removing this modification for the two last indexes, I can access
catalog's advanced management screen without error, but information is
not really fine : on a SetIndex for example, Document Count and Word
Count columns are displayed as security proxied BTrees.Length.Length
instance at 0xb4dc052c instead of their numeric values...

  Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Gary Poster



Tom Dossis wrote:


Tom Dossis wrote:


Gary Poster wrote:



Use the ones in zc.catalog.catalogindex.py instead: they do the  
necessary mixing-in for zope.app.catalog friendliness, without a patch.



Looks like I missed it - thank you.
The purpose of the patch was to convert documentCount  workCount to 
methods for the advanced view.

I'll try it out.



Turns out I was using zc.catatlog.catalogindex.SetIndex and the patch 
was to convert the above attributes to methods.  From memory they were 
showing up as repr's in the advanced catalog page.  Maybe there was a 
way to achieve this via zcml?



Ah-ha!  No, sounds like I just misimplemented.  I'll fix that up soon 
(unless you'd like to check in the fix with some small easy tests?)


Thanks

Gary
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users