STAX provides a class called STAXGlobal which is used for Python
variables that are updated across mutliple STAX-Threads. So, instead of
using the Python global keyword, you should initialize your
listOfServersContainingVdisks variable to a STAXGlobal variable containing
an empty list as follows:
<script>
server=STAXResult
listBDFtoFind={}
listOfServersContainingVdisks=STAXGlobal([])
</script>
See section "STAXGlobal" in the STAX User's Guide at
http://staf.sourceforge.net/current/STAX/staxug.html#STAXGlobal_Class for
more information.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Luca Robusto <lucarobu...@gmail.com>
To: "staf-users@lists.sourceforge.net"
<staf-users@lists.sourceforge.net>,
Date: 11/14/2013 09:45 AM
Subject: [staf-users] global variables in paralleliterate
Hi all,
I have this piece of code.
I expect the variable "listOfServersContainingVdisks" to be appendend with
all the servername of the paralleliterate according to the last lines of
code.
Instead, I am returned only the last assignment of the paralleliterate
loop, so that it will contain just the elements of the last iteration.
How can I avoid this?
<script>
server=STAXResult
listBDFtoFind={}
global listOfServersContainingVdisks
listOfServersContainingVdisks=[]
</script>
<paralleliterate var="destinationName" in="allDestinationlistName">
<sequence>
<script>
listBDFtoFind[destinationName]=[]
for index, item in enumerate(server[destinationName]):
if server[destinationName][index]['bdf'] == 'NoNe':
del listBDFtoFind[destinationName]
break
else:
listBDFtoFind[destinationName].append(server[destinationName][index]['bdf'])
listOfServersContainingVdisks.append(destinationName)
</script>
</sequence>
</paralleliterate>
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users