Getting Object Information in Workflow Script

5 messages Options Options
Embed this Post
Permalink
jenda72 () Getting Object Information in Workflow Script
Reply Threaded MoreMore options
Print post
Permalink
I'm trying to write a script to e-mail the object's URL after a workflow
transition. The script is following:


obj=sti.object
obj_url = obj.absolute_url()

mMsg = """
A document has been submitted for your review.
The url was %s.
"""

mTo =  # some fixed e-mail address
mFrom = # some fixed e-mail address
mSubj = 'Item has transitioned'
message = mMsg % (obj_url)
context.MailHost.send(message,mTo, mFrom, mSubj)


I have mapped the script to "submit" transition, I have set proxy role
as "manager" and owner of the script is admin (defined in Zope).

The problem is with "obj=sti.object":

When "Pending" state has "View" permission for anonymous, everything is
OK. But I need to hide pending documents from public, so our "Pending"
state has no "View" and "Access contents information" permissions for
anonymous. In that case, I get an error saying that privileges are
insufficient when I change the state from 'visible' to 'submitted'.

Why objects must be accesable from anonymous to be able to use
"obj=sti.object"?

Is there any solution?

Thank you for any help and idea.

Jan

[jan.pokorny.vcf]

begin:vcard
fn;quoted-printable:Jan Pokorn=C3=BD
n;quoted-printable:Pokorn=C3=BD;Jan
org;quoted-printable:Univerzita Karlova v Praze;=C3=9Astav v=C3=BDpo=C4=8Detn=C3=AD techniky
email;internet:jan.pokorny@...
x-mozilla-html:FALSE
version:2.1
end:vcard



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
robert rottermann () Re: Getting Object Information in Workflow Script
Reply Threaded MoreMore options
Print post
Permalink
send (or prepare) your message in the "before" script.
this script is called before the state (and the permission settings)
have changed
robert

Jan Pokorný wrote:

> I'm trying to write a script to e-mail the object's URL after a workflow
> transition. The script is following:
>
>
> obj=sti.object
> obj_url = obj.absolute_url()
>
> mMsg = """
> A document has been submitted for your review.
> The url was %s.
> """
>
> mTo =  # some fixed e-mail address
> mFrom = # some fixed e-mail address
> mSubj = 'Item has transitioned'
> message = mMsg % (obj_url)
> context.MailHost.send(message,mTo, mFrom, mSubj)
>
>
> I have mapped the script to "submit" transition, I have set proxy role
> as "manager" and owner of the script is admin (defined in Zope).
>
> The problem is with "obj=sti.object":
>
> When "Pending" state has "View" permission for anonymous, everything is
> OK. But I need to hide pending documents from public, so our "Pending"
> state has no "View" and "Access contents information" permissions for
> anonymous. In that case, I get an error saying that privileges are
> insufficient when I change the state from 'visible' to 'submitted'.
>
> Why objects must be accesable from anonymous to be able to use
> "obj=sti.object"?
>
> Is there any solution?
>
> Thank you for any help and idea.
>
> Jan
>  
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Plone-Users mailing list
> Plone-Users@...
> https://lists.sourceforge.net/lists/listinfo/plone-users
>  

[robert.vcf]

begin:vcard
fn:robert  rottermann
n:rottermann;robert
email;internet:robert@...
tel;work:031 333 10 20
tel;fax:031 333 10 23
tel;home:031 333 36 03
x-mozilla-html:FALSE
version:2.1
end:vcard



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
jenda72 () Re: Getting Object Information in Workflow Script
Reply Threaded MoreMore options
Print post
Permalink
Hi Robert,

thanks for your reply. Unfortunately, the state before the transition
change ("Visible") has also no View permission for anonymous. Only
published content is available to public. So calling the script before
causes the same problem.

When I remove proxy role "manager" from the script, "obj=sti.object"
works without any problem = a strange thing! But I need to set proxy
role "manager" because of Use mailhost service :-(

Do you think there is another way how to solve it? Is it a bug (Plone)?

Best regards,

Jan


dne 2.3.2007 4:56 robert rottermann napsal následující:

> send (or prepare) your message in the "before" script.
> this script is called before the state (and the permission settings)
> have changed
> robert
>
> Jan Pokorný wrote:
>> I'm trying to write a script to e-mail the object's URL after a workflow
>> transition. The script is following:
>>
>>
>> obj=sti.object
>> obj_url = obj.absolute_url()
>>
>> mMsg = """
>> A document has been submitted for your review.
>> The url was %s.
>> """
>>
>> mTo =  # some fixed e-mail address
>> mFrom = # some fixed e-mail address
>> mSubj = 'Item has transitioned'
>> message = mMsg % (obj_url)
>> context.MailHost.send(message,mTo, mFrom, mSubj)
>>
>>
>> I have mapped the script to "submit" transition, I have set proxy role
>> as "manager" and owner of the script is admin (defined in Zope).
>>
>> The problem is with "obj=sti.object":
>>
>> When "Pending" state has "View" permission for anonymous, everything is
>> OK. But I need to hide pending documents from public, so our "Pending"
>> state has no "View" and "Access contents information" permissions for
>> anonymous. In that case, I get an error saying that privileges are
>> insufficient when I change the state from 'visible' to 'submitted'.
>>
>> Why objects must be accesable from anonymous to be able to use
>> "obj=sti.object"?
>>
>> Is there any solution?
>>
>> Thank you for any help and idea.
>>
>> Jan
>>  
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Plone-Users mailing list
>> Plone-Users@...
>> https://lists.sourceforge.net/lists/listinfo/plone-users
>>  
>

[jan.pokorny.vcf]

begin:vcard
fn;quoted-printable:Jan Pokorn=C3=BD
n;quoted-printable:Pokorn=C3=BD;Jan
org;quoted-printable:Univerzita Karlova v Praze;=C3=9Astav v=C3=BDpo=C4=8Detn=C3=AD techniky
email;internet:jan.pokorny@...
x-mozilla-html:FALSE
version:2.1
end:vcard



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
jenda72 () Re: Getting Object Information in Workflow Script
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by robert rottermann
Thanks to great Yuri, now it is solved:

"It is a context problem. Do a script not proxied which call a proxied
script, should work."

So I have create extra script "mail_sending" just for sending e-mails,
with manager proxy role, and I call it from the main script without any
proxy role as: context.mail_sending(message,mTo,mFrom,mSubj).

It works! :-)

Jan


dne 2.3.2007 4:56 robert rottermann napsal následující:

> send (or prepare) your message in the "before" script.
> this script is called before the state (and the permission settings)
> have changed
> robert
>
> Jan Pokorný wrote:
>> I'm trying to write a script to e-mail the object's URL after a workflow
>> transition. The script is following:
>>
>>
>> obj=sti.object
>> obj_url = obj.absolute_url()
>>
>> mMsg = """
>> A document has been submitted for your review.
>> The url was %s.
>> """
>>
>> mTo =  # some fixed e-mail address
>> mFrom = # some fixed e-mail address
>> mSubj = 'Item has transitioned'
>> message = mMsg % (obj_url)
>> context.MailHost.send(message,mTo, mFrom, mSubj)
>>
>>
>> I have mapped the script to "submit" transition, I have set proxy role
>> as "manager" and owner of the script is admin (defined in Zope).
>>
>> The problem is with "obj=sti.object":
>>
>> When "Pending" state has "View" permission for anonymous, everything is
>> OK. But I need to hide pending documents from public, so our "Pending"
>> state has no "View" and "Access contents information" permissions for
>> anonymous. In that case, I get an error saying that privileges are
>> insufficient when I change the state from 'visible' to 'submitted'.
>>
>> Why objects must be accesable from anonymous to be able to use
>> "obj=sti.object"?
>>
>> Is there any solution?
>>
>> Thank you for any help and idea.
>>
>> Jan
>>  
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Plone-Users mailing list
>> Plone-Users@...
>> https://lists.sourceforge.net/lists/listinfo/plone-users
>>  
>

[jan.pokorny.vcf]

begin:vcard
fn;quoted-printable:Jan Pokorn=C3=BD
n;quoted-printable:Pokorn=C3=BD;Jan
org;quoted-printable:Univerzita Karlova v Praze;=C3=9Astav v=C3=BDpo=C4=8Detn=C3=AD techniky
email;internet:jan.pokorny@...
x-mozilla-html:FALSE
version:2.1
end:vcard



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Raphael Ritz () Re: Getting Object Information in Workflow Script
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by jenda72
Jan Pokorný schrieb:

> Hi Robert,
>
> thanks for your reply. Unfortunately, the state before the transition
> change ("Visible") has also no View permission for anonymous. Only
> published content is available to public. So calling the script before
> causes the same problem.
>
> When I remove proxy role "manager" from the script, "obj=sti.object"
> works without any problem = a strange thing! But I need to set proxy
> role "manager" because of Use mailhost service :-(
>
> Do you think there is another way how to solve it? Is it a bug (Plone)?
>

It is a known bug but not in Plone but rather the underlying Zope/CMF.

Realize your script as external method instead.

Raphael

> Best regards,
>
> Jan
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users