Automated email response

2007-04-07 Thread tonydevlin

I currently have the python code 
obj=sti.object 
creator = obj.Creator() 
history = sti.getHistory() 
wf_tool = context.portal_workflow 

mMsg = """ 
Content has been submitted for your review. 
The url was %s. 
The reason was %s. 
""" 

member = context.portal_membership.getMemberById(creator) 
creator = {'member':member, 
   'id':member.getId(), 
   'fullname':member.getProperty('fullname', 'Fullname missing'), 
   'email':member.getProperty('email', None)} 

actorid = wf_tool.getInfoFor(obj, 'actor') 
actor = context.portal_membership.getMemberById(actorid) 
reviewer = {'member':actor, 
'id':actor.getId(), 
'fullname':actor.getProperty('fullname', 'Fullname missing'), 
'email':actor.getProperty('email', None)} 

mTo = reviewer['email'] 
mFrom = creator['email'] 
mSubj = 'Your item has transitioned' 
obj_url = obj.absolute_url() #use portal_url + relative_url 
comments = wf_tool.getInfoFor(obj, 'comments') 

message = mMsg % (obj_url, comments) 
context.MailHost.send(message, mTo, mFrom, mSubj) 

This is attached to a transitions in a workflow and when a user selects the
transition they are emailed. I want it to email all of the users or selected
members like managers.  How would I go about changing the above code to do
that? 

I have tried the following code from the definitve guide to plone book, but
it does not have any effect on my workflow and does not email anyone.  Is
there something that I need to change on my setting possibly in Plone to get
the email response working, I have set up my mailhost and this works because
when I add a new user it emails them. 

# the objects we need 
object = state_change.object 
mship = context.portal_membership 
mhost = context.MailHost 
administratorEmailAddress = context.email_from_address 
  
# the message format, %s will be filled in from data 
message = """ 
From: %s 
To: %s 
Subject: New item submitted for approval - %s 
  
%s 
  
URL: %s 
""" 

for user in mship.listMembers(): 
if "Reviewer" in mship.getMemberById(user.id).getRoles(): 
if user.email: 
msg = message % ( 
 administratorEmailAddress, 
 user.email, 
 object.TitleOrId(), 
 object.Description(), 
 object.absolute_url() 
) 
mhost.send(msg)

-- 
View this message in context: 
http://www.nabble.com/Automated-email-response-tf3540615.html#a9883575
Sent from the Python - python-list mailing list archive at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automated email response

2007-04-13 Thread tonydevlin

I am only guessing as I have never done python code before, but i have had
another look at the code and was wondering if anyone knew if the below code
needs a for loop to look through members in plone and email out members with
a certain permission like Manager instead of just emailing 1 member like the
below code does.

obj=sti.object 
creator = obj.Creator() 
history = sti.getHistory() 
wf_tool = context.portal_workflow 

mMsg = """ 
Content has been submitted for your review. 
The url was %s. 
The reason was %s. 
""" 

member = context.portal_membership.getMemberById(creator) 
creator = {'member':member, 
   'id':member.getId(), 
   'fullname':member.getProperty('fullname', 'Fullname missing'), 
   'email':member.getProperty('email', None)} 

actorid = wf_tool.getInfoFor(obj, 'actor') 
actor = context.portal_membership.getMemberById(actorid) 
reviewer = {'member':actor, 
'id':actor.getId(), 
'fullname':actor.getProperty('fullname', 'Fullname missing'), 
'email':actor.getProperty('email', None)} 

mTo = reviewer['email'] 
mFrom = creator['email'] 
mSubj = 'Your item has transitioned' 
obj_url = obj.absolute_url() #use portal_url + relative_url 
comments = wf_tool.getInfoFor(obj, 'comments') 

message = mMsg % (obj_url, comments) 
context.MailHost.send(message, mTo, mFrom, mSubj) 


The loop i was thinking of was 
for user in context.portal_membership.listMembers():
if "Manager" in
context.portal_membership.getMemberById(user.id).getRoles(): 

But unsure of whether this is right and how to implement this into the code. 
Does anybody have any thoughts at all?


-- 
View this message in context: 
http://www.nabble.com/Automated-email-response-tf3540615.html#a9984870
Sent from the Python - python-list mailing list archive at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list


ArchGenXML please help

2007-01-12 Thread tonydevlin

I am creating a workflow in plone using argouml and archgenxml.  I have been
following the steps on the site:-
http://plone.org/documentation/tutorial/anonymously-adding-custom-content-types-with-argouml-and-archgenxml/creating-a-class-and-workflow-with-argouml

However I am confused at step 9 in creating the class section, where it
says:
"Now, save this file as "ProcessImprovement.zargo".  Pull up a command
prompt and navigate to that directory.  Make sure that you've added the
ArchGenXML directory to your env path, and type the following:
C:\Sandbox\Plone\Tutorial>ArchGenXML.py ProcessImprovement.zargo"

I have saved the file in the location 
C:\Documents and Settings\Tony\Desktop\Test\ProcessImprovement.zargo
However I dont know what to type in the python command prompt!!!

Can anyone help my, I would be very greatful, or if I am in the wrong place
do you know another forum where I could go as I have tried the plone online
on and it is no good.
Thank you.
-- 
View this message in context: 
http://www.nabble.com/ArchGenXML-please-help-tf2966867.html#a8301441
Sent from the Python - python-list mailing list archive at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ArchGenXML please help

2007-01-12 Thread tonydevlin



Bruno Desthuilliers wrote:
> 
> tonydevlin a écrit :
>> I am creating a workflow in plone using argouml and archgenxml.  I have
>> been
>> following the steps on the site:-
>> http://plone.org/documentation/tutorial/anonymously-adding-custom-content-types-with-argouml-and-archgenxml/creating-a-class-and-workflow-with-argouml
>> 
>> However I am confused at step 9 in creating the class section, where it
>> says:
>> "Now, save this file as "ProcessImprovement.zargo".  Pull up a command
>> prompt and navigate to that directory.  Make sure that you've added the
>> ArchGenXML directory to your env path, and type the following:
>> C:\Sandbox\Plone\Tutorial>ArchGenXML.py ProcessImprovement.zargo"
>> 
>> I have saved the file in the location 
>> C:\Documents and Settings\Tony\Desktop\Test\ProcessImprovement.zargo
>> However I dont know what to type in the python command prompt!!!
> 
> Which *python* command prompt ? The author is talking about a shell, 
> here (you know, this strange stuff that looks like good ole time DOS...).
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
> I yes sorry I was obviously not thinking properly, however there is still
> a problem, when I run this in dos after I have changed to the correct
> directory the ArchGenXML file that I downloaded does not work.  I renamed
> it from its original name because that did not work, it just came up with
> can not find program for it to run off.  It still does the same.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ArchGenXML-please-help-tf2966867.html#a8302734
Sent from the Python - python-list mailing list archive at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list