Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Show the review state of an item in Plone

Reply
Thread Tools

Show the review state of an item in Plone

 
 
Leo
Guest
Posts: n/a
 
      05-30-2004
I have the following problem:

When looking at a document, we would like to see what the review state
of that document is.

I set out to make a custom document_view page template based on the
default page template, together with some code from the
folder_contents page template.

I got the following code from folder_contents:

<td class="private"
tal:define="review_state python:getInfoFor(item, 'review_state',
'')"
tal:content="structure python:test(review_state, review_state,
'&nbsp;')"
tal:attributes="class python:test(review_state,
'state-'+review_state, 'state-private')"
i18n:translate="">&nbsp;
</td>

and pasted somewhere after the H1 of the document_view page template
to read:

<h2
tal:define="review_state python:getInfoFor(here, 'review_state',
'')"
tal:content="structure python:test(review_state, review_state,
'&nbsp;')"
tal:attributes="class python:test(review_state,
'state-'+review_state, 'state-private')"
i18n:translate="">&nbsp;
</h2>

that is, I changed the 'td' to 'h2' and 'item' to 'here'.

After saving the customized page template and navigating to a document
in Plone I got the following error:


Site error

This site encountered an error trying to fulfill your request. The
errors were:

Error Type
NameError
Error Value
name 'getInfoFor' is not defined
Request made at
2004/05/30 16:44:04.453 GMT+2


I am using Plone 2 (the Windows binary distribution).

Any help is apreciated.

Leo.
 
Reply With Quote
 
 
 
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      05-30-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Leo) writes:

> Error Type
> NameError
> Error Value
> name 'getInfoFor' is not defined


Using TAL you're in Zope land AFAIK, and getInfoFor() isn't a method I
can find in that API. You need to prefix - or even import - the
package, e.g. workflow_tool.getInfoFor(...).
 
Reply With Quote
 
 
 
 
Leo van Geest
Guest
Posts: n/a
 
      05-31-2004
Tor Iver Wilhelmsen wrote:
> (E-Mail Removed) (Leo) writes:
>
>
>>Error Type
>> NameError
>>Error Value
>> name 'getInfoFor' is not defined

>
>
> Using TAL you're in Zope land AFAIK, and getInfoFor() isn't a method I
> can find in that API. You need to prefix - or even import - the
> package, e.g. workflow_tool.getInfoFor(...).


Thank you for your answer. In fact, you pointed me to te right
direction. The getInfoFor is a method defined by the portal_workflow
module. A correct way to show the review state of an item in Plone is:

<h2
tal:define="wtool here/portal_workflow;
review_state python: wtool.getInfoFor(here, 'review_state')"
tal:content=review_state>
</h2>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
show hide divs - show last state upon reload/post ll Javascript 2 05-01-2008 12:15 PM
Show content of an external page in plone. sub@randers-hf-vuc.dk Python 0 01-24-2006 11:18 AM
Plone and Windows 2003? Ragnar Heil Python 0 12-26-2003 03:04 PM
Zope3 & Plone JZ Python 0 11-23-2003 10:47 AM
Plone question KH Python 1 10-14-2003 06:18 PM



Advertisments