[Zope-CMF] IndexableObjectWrapper

2009-03-09 Thread Miles
Hi,

Can anyone tell me if it is possible to register an adapter to provide a 
different IndexableObjectWrapper class from the stock CMF one?  There's 
some sort of framework code that hints that it ought to enable this, but 
I can't see how!

The code still seems to instantiate the wrapper directly using the 
class, rather than looking it up via the component architecture.

Can anyone explain what's going on?  I've drawn a blank from googling 
for examples.

Thanks,

Miles



___
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] IndexableObjectWrapper

2009-03-09 Thread Jens Vagelpohl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Mar 9, 2009, at 21:09 , Miles wrote:

 Can anyone tell me if it is possible to register an adapter to  
 provide a
 different IndexableObjectWrapper class from the stock CMF one?   
 There's
 some sort of framework code that hints that it ought to enable this,  
 but
 I can't see how!

 The code still seems to instantiate the wrapper directly using the
 class, rather than looking it up via the component architecture.

 Can anyone explain what's going on?  I've drawn a blank from googling
 for examples.

You already noticed that the wrapper is instantiated directly, so  
that's what's going on. No magic, no component architecture.

Whether that is good or bad or should be changed is a different issue.

jens



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkm1igUACgkQRAx5nvEhZLLXDgCgkfCiB2OLW/G2LxT1JVBOtGJJ
b3gAniLMUd22poUykxudnvXA5ibaK2hO
=GZpO
-END PGP SIGNATURE-
___
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] IndexableObjectWrapper

2009-03-09 Thread Wichert Akkerman
Previously Jens Vagelpohl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 
 On Mar 9, 2009, at 21:09 , Miles wrote:
 
  Can anyone tell me if it is possible to register an adapter to  
  provide a
  different IndexableObjectWrapper class from the stock CMF one?   
  There's
  some sort of framework code that hints that it ought to enable this,  
  but
  I can't see how!
 
  The code still seems to instantiate the wrapper directly using the
  class, rather than looking it up via the component architecture.
 
  Can anyone explain what's going on?  I've drawn a blank from googling
  for examples.
 
 You already noticed that the wrapper is instantiated directly, so  
 that's what's going on. No magic, no component architecture.
 
 Whether that is good or bad or should be changed is a different issue.

Martin Aspeli implemented an adapter based index wrapper for Plone 3.3.

Wichert.

-- 
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/   It is hard to make things simple.
___
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] IndexableObjectWrapper

2009-03-09 Thread Jens Vagelpohl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Mar 9, 2009, at 22:47 , Wichert Akkerman wrote:

 Previously Jens Vagelpohl wrote:
 On Mar 9, 2009, at 21:09 , Miles wrote:

 Can anyone tell me if it is possible to register an adapter to
 provide a
 different IndexableObjectWrapper class from the stock CMF one?

 You already noticed that the wrapper is instantiated directly, so
 that's what's going on. No magic, no component architecture.

 Whether that is good or bad or should be changed is a different  
 issue.

 Martin Aspeli implemented an adapter based index wrapper for Plone  
 3.3.

It's nice to see that Plone has it, but that doesn't help anyone  
working off the CMF itself. I wish there was more communication to  
determine where improvements fit best. Not knowing how Plone  
implemented it I would make a guess this one small item would have  
been better off in the CMF itself.

jens



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkm1lR8ACgkQRAx5nvEhZLJJvQCgnWpvHGu9TUCWOI5kmOzhRWAv
X8kAnAvVgxARYBlafyTF9FbosZZgO2Nn
=b1rx
-END PGP SIGNATURE-
___
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] IndexableObjectWrapper

2009-03-09 Thread Martin Aspeli
Miles wrote:
 Hi,
 
 Can anyone tell me if it is possible to register an adapter to provide a 
 different IndexableObjectWrapper class from the stock CMF one?  There's 
 some sort of framework code that hints that it ought to enable this, but 
 I can't see how!
 
 The code still seems to instantiate the wrapper directly using the 
 class, rather than looking it up via the component architecture.
 
 Can anyone explain what's going on?  I've drawn a blank from googling 
 for examples.

In plain CMF, probably not. In Plone, we have a custom CatalogTool which 
does let you provide a new wrapper wholesale based on object type.

In Plone 3.3, we'll *also* have a means of providing individual 
*attributes* of the wrapper via adapters. See 
http://pypi.python.org/pypi/plone.indexer. This package should work with 
stock CMF (though you'll need to wire it into the catalog tool yourself).

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

___
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] IndexableObjectWrapper

2009-03-09 Thread Martin Aspeli
Jens Vagelpohl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 
 On Mar 9, 2009, at 22:47 , Wichert Akkerman wrote:
 
 Previously Jens Vagelpohl wrote:
 On Mar 9, 2009, at 21:09 , Miles wrote:

 Can anyone tell me if it is possible to register an adapter to
 provide a
 different IndexableObjectWrapper class from the stock CMF one?

 You already noticed that the wrapper is instantiated directly, so
 that's what's going on. No magic, no component architecture.

 Whether that is good or bad or should be changed is a different  
 issue.
 Martin Aspeli implemented an adapter based index wrapper for Plone  
 3.3.
 
 It's nice to see that Plone has it, but that doesn't help anyone  
 working off the CMF itself. I wish there was more communication to  
 determine where improvements fit best. Not knowing how Plone  
 implemented it I would make a guess this one small item would have  
 been better off in the CMF itself.

Point taken!

Back in the day (before Plone 3.0), Alec Mitchell and I implemented a 
simple wrapper adapter that lets you look up a different version of the 
IndexableObjectWrapper. However, this wasn't terribly useful, because it 
seems what people want is not to replace the wrapper wholesale, but to 
provide different 'indexers' for specific catalogued attributes on a 
per-type basis.

Even before that, Plone had its own ExtensibleIndexableObjectWrapper 
that let you add 'getters' for attributes on the wrapper via module 
level imports. This has worked well, except that there's no way to make 
particular indexers work only on one particular content type.

In Plone 3.3, with the plone.indexer package, we've changed this so that 
you can add new 'getters' to the standard IOW via adapters. This is in 
the plone.indexer package: http://pypi.python.org/pypi/plone.indexer

This should work with plain CMF and be simple to hook into the catalogue 
tool. There are some discussions about licensing going on with the Plone 
Foundation, but chances are good that it can be licensed in such a way 
that CMF could adopt it you want. Doing so should be simple, even, and 
I'd be willing to help make this happen.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

___
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