Show the review state of an item in Plone

Discussion in 'Python' started by Leo, May 30, 2004.

  1. Leo

    Leo Guest

    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.
     
    Leo, May 30, 2004
    #1
    1. Advertising

  2. (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(...).
     
    Tor Iver Wilhelmsen, May 30, 2004
    #2
    1. Advertising

  3. Tor Iver Wilhelmsen wrote:
    > (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>
     
    Leo van Geest, May 31, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KH

    Plone question

    KH, Oct 14, 2003, in forum: Python
    Replies:
    1
    Views:
    337
    Josef Meile
    Oct 14, 2003
  2. Replies:
    0
    Views:
    576
  3. Mr. SweatyFinger

    insert item / review

    Mr. SweatyFinger, Mar 7, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    295
    Mr. SweatyFinger
    Mar 7, 2007
  4. www
    Replies:
    51
    Views:
    1,501
  5. ll
    Replies:
    2
    Views:
    662
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page