File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 <Document name =" iris-python-template.ZPM" >
44 <Module >
55 <Name >iris-python-template</Name >
6- <Version >1 .0.4 </Version >
6+ <Version >2 .0.1 </Version >
77 <Description >The simplest template to run embedded python</Description >
88 <Packaging >module</Packaging >
99 <SourcesRoot >src</SourcesRoot >
Original file line number Diff line number Diff line change @@ -4,25 +4,42 @@ Class dc.python.PersistentClass Extends %Persistent
44/// Description
55Property Test As %VarString ;
66
7- ClassMethod CreateRecord (ByRef id As %Integer ) As %Status
7+ ClassMethod CreateRecord (propValue As %VarString = " TestString " , ByRef id As %Integer ) As %Status
88{
99 set sc =$$$OK
10- set objPC =..%New ()
11- set objPC .Test =" Test string"
12- set sc =objPC .%Save ()
13- set id =objPC .%Id ()
10+ set obj =..%New ()
11+ set obj .Test =propValue
12+ set sc =obj .%Save ()
13+ set id =obj .%Id ()
14+ return sc
15+ }
16+
17+ ClassMethod CreateRecordPython (propValue As %VarString , ByRef id As %Integer ) [ Language = python ]
18+ {
19+ import iris
20+ obj =iris .cls (__name __)._New ()
21+ obj .Test =propValue
22+ sc =obj ._Save ()
23+ id =obj ._Id ()
1424 return sc
1525}
1626
1727/// opens the record by id and reads its property
18- ClassMethod ReadProperty (id As %Integer ) As %Status
28+ ClassMethod PrintProperty (id As %Integer ) As %Status
1929{
2030 Set sc = $$$OK
2131 set obj =..%OpenId (id ,,.sc )
2232 if $ISOBJECT (obj ) write obj .Test
2333 Return sc
2434}
2535
36+ ClassMethod PrintPropertyPython (id As %Integer ) [ Language = python ]
37+ {
38+ import iris
39+ obj =iris .cls (__name __)._OpenId (id )
40+ print (obj .Test )
41+ }
42+
2643Storage Default
2744{
2845<Data name =" PersistentClassDefaultData" >
You can’t perform that action at this time.
0 commit comments