[Zope-dev] Referencing a python method from a product page template

2004-10-20 Thread Coletti Massimo
Hi,

I am defining a Zope product to create a new portlet, the portlet will
display some contents retrieved from a python module.

Under the product dir I have a file queryBFE.py, with a method
returnQuery(); the method returns a dictionary.

In the __init__.py at product level, there is an:
allow_module('Products.CorpQuotes.queryBFE')

The portlet page template is stored under a skin directory, properly
registered in CFM.

In the portlet text, I tried two syntaxes to call the method:

a)

span tal:define=modulo here/queryBFE;
quotazione modulo/returnQuery;

b)

span tal:define=quotazione
modules/Products/CorpQuotes/queryBFE/returnQuery
 
The first one returns:

Exception Type
AttributeError
Exception Value
queryBFE

The second one returns:

Tipo di errore
AttributeError
Valore dell'errore
queryBFE

  Module Products.PageTemplates.TALES, line 220, in evaluate
   - URL: /Plone/FinnatHome_view
   - Line 13, Column 10
   - Expression: standard:'here/queryBFE'
   - Names:
  {'container': PloneSite instance at 0170EF50,
   'context': Document at /Plone/index.html,
   'default': Products.PageTemplates.TALES.Default instance at
0x010BF5F8,
   'here': Document at /Plone/index.html,
   'loop': SafeMapping instance at 025E2C50,
   'modules':
Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at
0x010AED00,
   'nothing': None,
   'options': {'args': ()},
   'repeat': SafeMapping instance at 025E2C50,
   'request': HTTPRequest, URL=http://localhost:8082/index.html,
   'root': Application instance at 017C29E0,
   'template': ZopePageTemplate at /Plone/FinnatHome_view used for
/Plone/index.html,
   'traverse_subpath': [],
   'user': coletti}
  Module Products.PageTemplates.Expressions, line 201, in __call__
  Module Products.PageTemplates.Expressions, line 189, in _eval
  Module Products.PageTemplates.Expressions, line 145, in _eval
   - __traceback_info__: here
  Module Products.PageTemplates.Expressions, line 354, in
restrictedTraverse
   - __traceback_info__: {'path': ['queryBFE'],
'TraversalRequestNameStack': []}
AttributeError: queryBFE

HELP!

massimo

This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


R: [Zope-dev] Referencing a python method from a product page template

2004-10-20 Thread Coletti Massimo
Pardon, the traceback of option b was not correct, here is the right one

-Messaggio originale-
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di Coletti Massimo
Inviato: mercoledì 20 ottobre 2004 10.31
A: [EMAIL PROTECTED]
Oggetto: [Zope-dev] Referencing a python method from a product page template


Hi,

I am defining a Zope product to create a new portlet, the portlet will display some 
contents retrieved from a python module.

Under the product dir I have a file queryBFE.py, with a method returnQuery(); the 
method returns a dictionary.

In the __init__.py at product level, there is an:
allow_module('Products.CorpQuotes.queryBFE')

The portlet page template is stored under a skin directory, properly registered in CFM.

In the portlet text, I tried two syntaxes to call the method:

a)

span tal:define=modulo here/queryBFE;
quotazione modulo/returnQuery;

b)

span tal:define=quotazione modules/Products/CorpQuotes/queryBFE/returnQuery
 
The first one returns:

Exception Type
AttributeError
Exception Value
queryBFE

The second one returns:

Exception Type
Unauthorized
Exception Value
You are not allowed to access 'queryBFE' in this context

  Module Products.PageTemplates.TALES, line 220, in evaluate
   - URL: /Plone/FinnatHome_view
   - Line 14, Column 10
   - Expression: standard:'modules/Products/CorpQuotes/queryBFE/returnQuery'
   - Names:
  {'container': PloneSite instance at 0170EF50,
   'context': Document at /Plone/index.html,
   'default': Products.PageTemplates.TALES.Default instance at 0x010BF5F8,
   'here': Document at /Plone/index.html,
   'loop': SafeMapping instance at 025DEC30,
   'modules': Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance 
at 0x010AED00,
   'nothing': None,
   'options': {'args': ()},
   'repeat': SafeMapping instance at 025DEC30,
   'request': HTTPRequest, URL=http://localhost:8082/index.html/FinnatHome_view,
   'root': Application instance at 017C29E0,
   'template': ZopePageTemplate at /Plone/FinnatHome_view used for 
/Plone/index.html,
   'traverse_subpath': [],
   'user': coletti}
  Module Products.PageTemplates.Expressions, line 201, in __call__
  Module Products.PageTemplates.Expressions, line 189, in _eval
  Module Products.PageTemplates.Expressions, line 145, in _eval
   - __traceback_info__: modules
  Module Products.PageTemplates.Expressions, line 340, in restrictedTraverse
   - __traceback_info__: {'path': ['Products', 'CorpQuotes', 'queryBFE', 
'returnQuery'], 'TraversalRequestNameStack': ['returnQuery']}
Unauthorized: You are not allowed to access 'queryBFE' in this context

This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


R: [Zope-dev] Referencing a python method from a product page template

2004-10-20 Thread Coletti Massimo
Solved !

There are some wrong info in Zope Developers Book.

The solution is here:
http://mail.zope.org/pipermail/zope/2004-May/thread.html#149569

Massimo

-Messaggio originale-
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di Coletti Massimo
Inviato: mercoledì 20 ottobre 2004 10.40
A: [EMAIL PROTECTED]
Oggetto: R: [Zope-dev] Referencing a python method from a product page template


Pardon, the traceback of option b was not correct, here is the right one

-Messaggio originale-
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di Coletti Massimo
Inviato: mercoledì 20 ottobre 2004 10.31
A: [EMAIL PROTECTED]
Oggetto: [Zope-dev] Referencing a python method from a product page template


Hi,

I am defining a Zope product to create a new portlet, the portlet will display some 
contents retrieved from a python module.

Under the product dir I have a file queryBFE.py, with a method returnQuery(); the 
method returns a dictionary.

In the __init__.py at product level, there is an:
allow_module('Products.CorpQuotes.queryBFE')

The portlet page template is stored under a skin directory, properly registered in CFM.

In the portlet text, I tried two syntaxes to call the method:

a)

span tal:define=modulo here/queryBFE;
quotazione modulo/returnQuery;

b)

span tal:define=quotazione modules/Products/CorpQuotes/queryBFE/returnQuery
 
The first one returns:

Exception Type
AttributeError
Exception Value
queryBFE

The second one returns:

Exception Type
Unauthorized
Exception Value
You are not allowed to access 'queryBFE' in this context

  Module Products.PageTemplates.TALES, line 220, in evaluate
   - URL: /Plone/FinnatHome_view
   - Line 14, Column 10
   - Expression: standard:'modules/Products/CorpQuotes/queryBFE/returnQuery'
   - Names:
  {'container': PloneSite instance at 0170EF50,
   'context': Document at /Plone/index.html,
   'default': Products.PageTemplates.TALES.Default instance at 0x010BF5F8,
   'here': Document at /Plone/index.html,
   'loop': SafeMapping instance at 025DEC30,
   'modules': Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance 
at 0x010AED00,
   'nothing': None,
   'options': {'args': ()},
   'repeat': SafeMapping instance at 025DEC30,
   'request': HTTPRequest, URL=http://localhost:8082/index.html/FinnatHome_view,
   'root': Application instance at 017C29E0,
   'template': ZopePageTemplate at /Plone/FinnatHome_view used for 
/Plone/index.html,
   'traverse_subpath': [],
   'user': coletti}
  Module Products.PageTemplates.Expressions, line 201, in __call__
  Module Products.PageTemplates.Expressions, line 189, in _eval
  Module Products.PageTemplates.Expressions, line 145, in _eval
   - __traceback_info__: modules
  Module Products.PageTemplates.Expressions, line 340, in restrictedTraverse
   - __traceback_info__: {'path': ['Products', 'CorpQuotes', 'queryBFE', 
'returnQuery'], 'TraversalRequestNameStack': ['returnQuery']}
Unauthorized: You are not allowed to access 'queryBFE' in this context

This e-mail and any attachments may contain confidential and privileged information. 
If you are not the intended recipient, please notify the sender immediately by return 
e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this 
information by a person other than the intended recipient is unauthorized and may be 
illegal. ___
Zope-Dev maillist  -  [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Referencing a python method from a product page template

2004-10-20 Thread Jens Vagelpohl
On Oct 20, 2004, at 11:37, Coletti Massimo wrote:
Solved !
There are some wrong info in Zope Developers Book.
The solution is here:
http://mail.zope.org/pipermail/zope/2004-May/thread.html#149569
I've corrected it in the 2.7 book:
http://www.plope.com/Books/2_7Edition/AdvZPT.stx#3-95
jens

---
Jens Vagelpohl  [EMAIL PROTECTED]
Software Engineer   Zope - done medium rare
Zetwork GmbHhttp://www.zetwork.com/
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )