Thomas:

Modifying an example of the the grokcore.view package documentation 
(http://pypi.python.org/pypi/grokcore.view):

class Hello(grokcore.view.View):
    grokcore.view.context(zope.interface.Interface)
    grokcore.view.name('anotherdifferentname')

This will register the Hello view class under the name "anotherdifferentname". 
This name can be used in URLs for example.

The grokcore.view package provides some of the directives provided by the 
grokcore.component package. They're like aliases. In fact, if you check the 
grokcore.view source (grokcore.view.meta) you will see that what it does is to 
import the original directives from grokcore.component and provides like an 
"alias" to them. This is what grok does too (in some places).

You can use the grokcore.component.name with other components like adapters, 
viewlets and utilities too.

I hope this helps.

Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante 
buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


--- On Wed, 4/15/09, Thomas Richter <[email protected]> wrote:

> From: Thomas Richter <[email protected]>
> Subject: Re: [Schooltoolers] grok and schooltool
> To: [email protected]
> Date: Wednesday, April 15, 2009, 12:24 PM
> Am Mittwoch, den 15.04.2009, 12:03 -0700 schrieb Douglas
> Cerna:
> > import grokcore.view
> > 
> > class MyView(grokcore.view.View):
> > 
> Thankx a lot.
> 1 more question: the grok.name() directive I could not find
> in grokcore.
> How do I name a View apart from using the Name of the
> ViewClassName?
> 
> Thomas


      

_______________________________________________
Mailing list: https://launchpad.net/~schooltoolers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~schooltoolers
More help   : https://help.launchpad.net/ListHelp

Reply via email to