hi
i had downloaded leave.zexp from the following url
http://www.openflow.it/EN/Download/index_html
I have installded open flow 1.1.0
i have plone,zope on ,my linux box.
Now i tried to rewrite the application using zpt +
formulator(originally written in dtml).
I have written the following zpt files
1)leave_startform_zpt
2)leave_start_zpt
a macro leaveform_macro for leave_startform_zpt
file.
Now my program goes like this
leave_startform_zpt -- macros -- leave_start_zpt --
gotoOF (this is a python file),
Plz see the files in the attachemnt. These are the
files i have added. the other files remain same. no
change
I get the following error like
Error Type
NameError
Error Value
global name 'workflow' is not defined
what is the problem
plz help me
thanks
prasad
Send free SMS using the Yahoo! Messenger. Go to http://in.mobile.yahoo.com/new/pc/
1) leave_startform_zpt
---
html
headtb
title tal:content=template/titleThe title/title
head
body
p metal:use-macro=here/common_pages/macros/leaveform_macro /
/body
/html
---
2) leaveform_macro
---
div metal:define-macro=leaveform_macro
form name=leave_startform_formulator method=post action=leave_start_zpt
table tal:define=form here/leave_startform_formulator align=center
tr tal:define=startdate request/startdate|nothing
th align=left
font size=5font face=verdanab
Start Date:
/b/font/font
/th
tdinput type=text name=startdate
tal:replace=structure python:form.startdate.render(startdate) /
/td
/tr
tr tal:define=enddate request/enddate|nothing
th align=left
font size=5font face=verdanab
End Date:
/b/font/font
/th
tdinput type=text name=enddate
tal:replace=structure python:form.enddate.render(enddate)
/td
/tr
tr tal:define=reason request/reason|nothing
th align=left
font size=4font face=verdanab
Reason:
/b/font/font
/th
tdtextarea type=text name=reason
tal:replace=structure python:form.reason.render(reason)/textarea
/td
/tr
tr tal:define=leavetype request/leavetype|nothing
th align=left
font size=4font face=verdanab
LEA:
/b/font/font
/th
tdtextarea type=text name=leavetype
tal:replace=structure
python:form.leavetype.render(leavetype)/textarea
/td
/tr
tr cols=*,350,*
td /td
td align=centerinput type=submit value= Submit /td
td /td
/tr
/tablebr
/form
/div
---
3) leave_start_zpt
---
html
head
!-- Put your CSS, meta tags and scripts here. --
/head
body bgcolor=#ff
p tal:replace=structure python:here.gotoOF() /
!--p tal:replace=structure
python:here.gotoOF(startdate,enddate,reason,leavetype,requested,formalia,approved,decision)
/--
!--span tal:define=result python:here.mailScript()/span--
/body
/html
---
4) gotoOF
---
no parametres for this.
instance=workflow.addInstance('leaverequest',AUTHENTICATED_USER.getUserName(),'no
comment','Request for leave by ' + AUTHENTICATED_USER.getUserName(), activation=0)
instobj=_.getattr(workflow,instance)
form = context.leave_startform_formulator
instobj=getattr(workflow,instance)
instobj.manage_addProperty('startdate', startdate, 'string')
instobj.manage_addProperty('enddate', enddate, 'string')
instobj.manage_addProperty('reason', reason, 'text')
instobj.manage_addProperty('leavetype', leavetype, 'string')
instobj.manage_addProperty('requested', '', 'string')
instobj.manage_addProperty('formalia', '', 'string')
instobj.manage_addProperty('approved', '', 'string')
instobj.manage_addProperty('decision', '', 'text')
workflow.startInstance(instance)
print Done
return printed
---