VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-python.xsl@ 20958

Last change on this file since 20958 was 20036, checked in by vboxsync, 16 years ago

Python: docs update, webserice bindings support custom URLs, cleanup

  • Property svn:eol-style set to native
File size: 23.8 KB
Line 
1<xsl:stylesheet version = '1.0'
2 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
3 xmlns:vbox="http://www.virtualbox.org/">
4
5<!--
6
7 websrv-python.xsl:
8 XSLT stylesheet that generates VirtualBox_services.py from
9 VirtualBox.xidl. This Python file represents our
10 web service API. Depends on WSDL file for actual SOAP bindings.
11
12 Copyright (C) 2008 Sun Microsystems, Inc.
13
14 This file is part of VirtualBox Open Source Edition (OSE), as
15 available from http://www.virtualbox.org. This file is free software;
16 you can redistribute it and/or modify it under the terms of the GNU
17 General Public License (GPL) as published by the Free Software
18 Foundation, in version 2 as it comes in the "COPYING" file of the
19 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21
22 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23 Clara, CA 95054 USA or visit http://www.sun.com if you need
24 additional information or have any questions.
25-->
26
27
28<xsl:output
29 method="text"
30 version="1.0"
31 encoding="utf-8"
32 indent="no"/>
33
34<xsl:include href="websrv-shared.inc.xsl" />
35
36<xsl:variable name="G_setSuppressedInterfaces"
37 select="//interface[@wsmap='suppress']" />
38
39<xsl:template name="emitConvertedType">
40 <xsl:param name="ifname" />
41 <xsl:param name="methodname" />
42 <xsl:param name="type" />
43 <xsl:choose>
44 <xsl:when test="$type='wstring'">String</xsl:when>
45 <xsl:when test="$type='boolean'">Boolean</xsl:when>
46 <xsl:when test="$type='unsigned long'">UnsignedInt</xsl:when>
47 <xsl:when test="$type='double'">Double</xsl:when>
48 <xsl:when test="$type='float'">Float</xsl:when>
49 <xsl:when test="$type='long'">Int</xsl:when>
50 <xsl:when test="$type='long long'">Long</xsl:when>
51 <xsl:when test="$type='short'">Short</xsl:when>
52 <xsl:when test="$type='unsigned short'">UnsignedShort</xsl:when>
53 <xsl:when test="$type='unsigned long long'">UnsignedLong</xsl:when>
54 <xsl:when test="$type='result'">UnsignedInt</xsl:when>
55 <xsl:when test="$type='uuid'">UUID</xsl:when>
56 <xsl:when test="$type='$unknown'">IUnknown</xsl:when>
57 <xsl:otherwise><xsl:value-of select="$type" /></xsl:otherwise>
58 </xsl:choose>
59</xsl:template>
60
61<xsl:template name="emitOutParam">
62 <xsl:param name="ifname" />
63 <xsl:param name="methodname" />
64 <xsl:param name="type" />
65 <xsl:param name="value" />
66 <xsl:param name="safearray" />
67
68 <xsl:call-template name="emitConvertedType">
69 <xsl:with-param name="ifname" select="$ifname" />
70 <xsl:with-param name="methodname" select="$methodname" />
71 <xsl:with-param name="type" select="$type" />
72 </xsl:call-template>
73 <xsl:text>(</xsl:text>
74 <xsl:text>self.mgr,</xsl:text>
75 <xsl:value-of select="$value"/>
76 <xsl:if test="$safearray='yes'">
77 <xsl:value-of select="', True'"/>
78 </xsl:if>
79 <xsl:text>)</xsl:text>
80</xsl:template>
81
82
83<xsl:template name="emitGetAttribute">
84 <xsl:param name="ifname" />
85 <xsl:param name="attrname" />
86 <xsl:param name="attrtype" />
87 <xsl:param name="attrsafearray" />
88 <xsl:variable name="fname"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable>
89 def <xsl:value-of select="$fname"/>(self):
90 req=<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>RequestMsg()
91 req._this=self.handle
92 val=self.mgr.getPort().<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>(req)
93 <xsl:text>return </xsl:text>
94 <xsl:call-template name="emitOutParam">
95 <xsl:with-param name="ifname" select="$ifname" />
96 <xsl:with-param name="methodname" select="@name" />
97 <xsl:with-param name="type" select="$attrtype" />
98 <xsl:with-param name="value" select="concat('val.','_returnval')" />
99 <xsl:with-param name="safearray" select="@safearray"/>
100 </xsl:call-template>
101</xsl:template>
102
103<xsl:template name="emitSetAttribute">
104 <xsl:param name="ifname" />
105 <xsl:param name="attrname" />
106 <xsl:param name="attrtype" />
107 <xsl:param name="attrsafearray" />
108 <xsl:variable name="fname"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable>
109 def <xsl:value-of select="$fname"/>(self, value):
110 req=<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>RequestMsg()
111 req._this=self.handle
112 if type(value) in [int, bool, basestring]:
113 req._<xsl:value-of select="$attrname"/> = value
114 else:
115 req._<xsl:value-of select="$attrname"/> = value.handle
116 self.mgr.getPort().<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>(req)
117</xsl:template>
118
119<xsl:template name="collection">
120 <xsl:variable name="cname"><xsl:value-of select="@name" /></xsl:variable>
121 <xsl:variable name="ename"><xsl:value-of select="@type" /></xsl:variable>
122class <xsl:value-of select="$cname"/>:
123 def __init__(self, mgr, array):
124 self.array = array
125 self.mgr = mgr
126
127 def __next(self):
128 return self.array.__next()
129
130 def __size(self):
131 return self.array._array.__size()
132
133 def __len__(self):
134 return self.array._array.__len__()
135
136 def __getitem__(self, index):
137 return <xsl:value-of select="$ename"/>(self.mgr, self.array._array[index])
138
139</xsl:template>
140
141<xsl:template name="interface">
142 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
143class <xsl:value-of select="$ifname"/>:
144 def __init__(self, mgr, handle, isarray = False):
145 self.mgr = mgr
146 if handle is None or handle == "":
147 raise Exception("bad handle: "+str(handle))
148 self.handle = handle
149 self.isarray = isarray
150<!--
151 This doesn't work now
152 mgr.register(handle)
153
154 def __del__(self):
155 mgr.unregister(self.handle)
156-->
157 def releaseRemote(self):
158 try:
159 req=IManagedObjectRef_releaseRequestMsg()
160 req._this=handle
161 self.mgr.getPort().IManagedObjectRef_release(req)
162 except:
163 pass
164
165 def __next(self):
166 if self.isarray:
167 return self.handle.__next()
168 raise TypeError, "iteration over non-sequence"
169
170 def __size(self):
171 if self.isarray:
172 return self.handle.__size()
173 raise TypeError, "iteration over non-sequence"
174
175 def __len__(self):
176 if self.isarray:
177 return self.handle.__len__()
178 raise TypeError, "iteration over non-sequence"
179
180 def __getitem__(self, index):
181 if self.isarray:
182 return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index])
183 raise TypeError, "iteration over non-sequence"
184
185 def __str__(self):
186 return self.handle
187
188 def isValid(self):
189 return self.handle != None and self.handle != ''
190
191 def __getattr__(self,name):
192 hndl = <xsl:value-of select="$ifname" />._Attrs_.get(name, None)
193 if (hndl != None and hndl[0] != None):
194 return hndl[0](self)
195 else:
196 raise AttributeError
197
198 def __setattr__(self, name, val):
199 hndl = <xsl:value-of select="$ifname" />._Attrs_.get(name, None)
200 if (hndl != None and hndl[1] != None):
201 hndl[1](self,val)
202 else:
203 self.__dict__[name] = val
204
205 <xsl:for-each select="method">
206 <xsl:call-template name="method"/>
207 </xsl:for-each>
208
209 <xsl:for-each select="attribute">
210 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
211 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
212 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
213 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
214 <xsl:choose>
215 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
216 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
217 </xsl:when>
218 <xsl:otherwise>
219 <xsl:choose>
220 <xsl:when test="@readonly='yes'">
221 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
225 </xsl:otherwise>
226 </xsl:choose>
227 <!-- aa) get method: emit request and result -->
228 <xsl:call-template name="emitGetAttribute">
229 <xsl:with-param name="ifname" select="$ifname" />
230 <xsl:with-param name="attrname" select="$attrname" />
231 <xsl:with-param name="attrtype" select="$attrtype" />
232 </xsl:call-template>
233 <!-- bb) emit a set method if the attribute is read/write -->
234 <xsl:if test="not($attrreadonly='yes')">
235 <xsl:call-template name="emitSetAttribute">
236 <xsl:with-param name="ifname" select="$ifname" />
237 <xsl:with-param name="attrname" select="$attrname" />
238 <xsl:with-param name="attrtype" select="$attrtype" />
239 </xsl:call-template>
240 </xsl:if>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:for-each>
244
245
246 _Attrs_=<xsl:text>{</xsl:text>
247 <xsl:for-each select="attribute">
248 <xsl:if test="not( @type=($G_setSuppressedInterfaces/@name) )">
249 <xsl:text> </xsl:text>'<xsl:value-of select="@name"/>'<xsl:text>:[</xsl:text>
250 <xsl:call-template name="makeGetterName">
251 <xsl:with-param name="attrname" select="@name"/>
252 </xsl:call-template>
253 <xsl:text>,</xsl:text>
254 <xsl:choose>
255 <xsl:when test="@readonly='yes'">
256 <xsl:text>None</xsl:text>
257 </xsl:when>
258 <xsl:otherwise>
259 <xsl:call-template name="makeSetterName">
260 <xsl:with-param name="attrname" select="@name"/>
261 </xsl:call-template>,
262 </xsl:otherwise>
263 </xsl:choose>
264 <xsl:text>]</xsl:text>
265 <xsl:if test="not(position()=last())"><xsl:text>,&#10;</xsl:text></xsl:if>
266 </xsl:if>
267 </xsl:for-each>
268 <xsl:text>}</xsl:text>
269</xsl:template>
270
271<xsl:template name="interfacestruct">
272 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
273class <xsl:value-of select="$ifname"/>:
274 def __init__(self, mgr, handle):<xsl:for-each select="attribute">
275 self.mgr = mgr
276 self.<xsl:value-of select="@name"/> = handle._<xsl:value-of select="@name"/>
277 </xsl:for-each>
278
279 <!-- also do getters/setters -->
280 <xsl:for-each select="attribute">
281 def <xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self):
282 return self.<xsl:value-of select="@name"/>
283
284 def <xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self):
285 raise Error, 'setters not supported'
286 </xsl:for-each>
287</xsl:template>
288
289<xsl:template name="genreq">
290 <xsl:text>req=</xsl:text><xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>RequestMsg()
291 req._this=self.handle
292 <xsl:for-each select="param[@dir='in']">
293 req._<xsl:value-of select="@name" />=_arg_<xsl:value-of select="@name" />
294 </xsl:for-each>
295 val=self.mgr.getPort().<xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>(req)
296 <!-- return needs to be the first one -->
297 return <xsl:for-each select="param[@dir='return']">
298 <xsl:call-template name="emitOutParam">
299 <xsl:with-param name="ifname" select="../@name" />
300 <xsl:with-param name="methodname" select="@name" />
301 <xsl:with-param name="type" select="@type" />
302 <xsl:with-param name="value" select="concat('val.','_returnval')" />
303 <xsl:with-param name="safearray" select="@safearray"/>
304 </xsl:call-template>
305 <xsl:if test="../param[@dir='out']">
306 <xsl:text>, </xsl:text>
307 </xsl:if>
308 </xsl:for-each>
309 <xsl:for-each select="param[@dir='out']">
310 <xsl:if test="not(position()=1)">
311 <xsl:text>, </xsl:text>
312 </xsl:if>
313 <xsl:call-template name="emitOutParam">
314 <xsl:with-param name="ifname" select="../@name" />
315 <xsl:with-param name="methodname" select="@name" />
316 <xsl:with-param name="type" select="@type" />
317 <xsl:with-param name="value" select="concat('val._',@name)" />
318 <xsl:with-param name="safearray" select="@safearray"/>
319 </xsl:call-template>
320 </xsl:for-each>
321 <xsl:text>&#10;&#10;</xsl:text>
322</xsl:template>
323
324<xsl:template name="method" >
325 def <xsl:value-of select="@name"/><xsl:text>(self</xsl:text>
326 <xsl:for-each select="param[@dir='in']">
327 <xsl:text>, </xsl:text>
328 <xsl:value-of select="concat('_arg_',@name)"/>
329 </xsl:for-each><xsl:text>):&#10; </xsl:text>
330 <xsl:call-template name="genreq"/>
331</xsl:template>
332
333<xsl:template name="makeConstantName" >
334 <xsl:choose>
335 <!-- special case for reserved word, maybe will need more in the future -->
336 <xsl:when test="@name='None'">
337 <xsl:text>_None</xsl:text>
338 </xsl:when>
339 <xsl:otherwise>
340 <xsl:value-of select="@name"/>
341 </xsl:otherwise>
342 </xsl:choose>
343</xsl:template>
344
345<xsl:template name="enum">
346class <xsl:value-of select="@name"/>:
347 def __init__(self,mgr,handle):
348 self.mgr=mgr
349 if isinstance(handle,basestring):
350 self.handle=<xsl:value-of select="@name"/>._ValueMap[handle]
351 else:
352 self.handle=handle
353
354 def __eq__(self,other):
355 if isinstance(other,<xsl:value-of select="@name"/>):
356 return self.handle == other.handle
357 if isinstance(other,int):
358 return self.handle == other
359 return False
360
361 def __ne__(self,other):
362 if isinstance(other,<xsl:value-of select="@name"/>):
363 return self.handle != other.handle
364 if isinstance(other,int):
365 return self.handle != other
366 return True
367
368 def __str__(self):
369 return <xsl:value-of select="@name"/>._NameMap[self.handle]
370
371 def __int__(self):
372 return self.handle
373
374 _NameMap={<xsl:for-each select="const">
375 <xsl:value-of select="@value"/>:'<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">,</xsl:if>
376 </xsl:for-each>}
377 _ValueMap={<xsl:for-each select="const">
378 '<xsl:value-of select="@name"/>':<xsl:value-of select="@value"/><xsl:if test="not(position()=last())">,</xsl:if>
379 </xsl:for-each>}
380
381<xsl:for-each select="const"><xsl:text> </xsl:text><xsl:call-template name="makeConstantName"><xsl:with-param name="name" select="@name"/></xsl:call-template>=<xsl:value-of select="@value"/><xsl:text>&#xa;</xsl:text>
382</xsl:for-each>
383</xsl:template>
384
385<xsl:template match="/">
386<xsl:text># Copyright (C) 2008-2009 Sun Microsystems, Inc.
387#
388# This file is part of VirtualBox Open Source Edition (OSE), as
389# available from http://www.virtualbox.org. This file is free software;
390# you can redistribute it and/or modify it under the terms of the GNU
391# General Public License (GPL) as published by the Free Software
392# Foundation, in version 2 as it comes in the "COPYING" file of the
393# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
394# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
395#
396# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
397# Clara, CA 95054 USA or visit http://www.sun.com if you need
398# additional information or have any questions.
399#
400# This file is autogenerated from VirtualBox.xidl, DO NOT EDIT!
401#
402from VirtualBox_services import *
403
404class ManagedManager:
405 def __init__(self):
406 self.map = {}
407
408 def register(self,handle):
409 if handle == None:
410 return
411 c = self.map.get(handle,0)
412 c = c + 1
413 self.map[handle]=c
414
415 def unregister(self,handle):
416 if handle == None:
417 return
418 c = self.map.get(handle,-1)
419 if c == -1:
420 raise Error, 'wrong refcount'
421 c = c - 1
422 if c == 0:
423 try:
424 req=IManagedObjectRef_releaseRequestMsg()
425 req._this=handle
426 self.mgr.getPort().IManagedObjectRef_release(req)
427 except:
428 pass
429 finally:
430 self.map[handle] = -1
431 else:
432 self.map[handle] = c
433
434class String:
435 def __init__(self, mgr, handle, isarray = False):
436 self.handle = handle
437 self.isarray = isarray
438
439 def __next(self):
440 if self.isarray:
441 return self.handle.__next()
442 raise TypeError, "iteration over non-sequence"
443
444 def __size(self):
445 if self.isarray:
446 return self.handle.__size()
447 raise TypeError, "iteration over non-sequence"
448
449 def __len__(self):
450 if self.isarray:
451 return self.handle.__len__()
452 raise TypeError, "iteration over non-sequence"
453
454 def __getitem__(self, index):
455 if self.isarray:
456 return String(self.handle[index])
457 raise TypeError, "iteration over non-sequence"
458
459 def __str__(self):
460 return self.handle
461
462 def __eq__(self,other):
463 if self.isarray:
464 return isinstance(other,String) and self.handle == other.handle
465 if isinstance(other,String):
466 return self.handle == other.handle
467 if isinstance(other,basestring):
468 return self.handle == other
469 return False
470
471 def __ne__(self,other):
472 if self.isarray:
473 return not isinstance(other,String) or self.handle == other.handle
474 if isinstance(other,String):
475 return self.handle != other.handle
476 if isinstance(other,basestring):
477 return self.handle != other
478 return True
479
480
481class UUID:
482 def __init__(self, mgr, handle, isarray = False):
483 self.handle = handle
484 self.isarray = isarray
485
486 def __next(self):
487 if self.isarray:
488 return self.handle.__next()
489 raise TypeError, "iteration over non-sequence"
490
491 def __size(self):
492 if self.isarray:
493 return self.handle.__size()
494 raise TypeError, "iteration over non-sequence"
495
496 def __len__(self):
497 if self.isarray:
498 return self.handle.__len__()
499 raise TypeError, "iteration over non-sequence"
500
501 def __getitem__(self, index):
502 if self.isarray:
503 return UUID(self.handle[index])
504 raise TypeError, "iteration over non-sequence"
505
506 def __str__(self):
507 return self.handle
508
509 def __eq__(self,other):
510 if self.isarray:
511 return isinstance(other,UUID) and self.handle == other.handle
512 if isinstance(other,UUID):
513 return self.handle == other.handle
514 if isinstance(other,basestring):
515 return self.handle == other
516 return False
517
518 def __ne__(self,other):
519 if self.isarray:
520 return not isinstance(other,UUID) or self.handle == other.handle
521 if isinstance(other,UUID):
522 return self.handle != other.handle
523 if isinstance(other,basestring):
524 return self.handle != other
525 return True
526
527class Boolean:
528 def __init__(self, mgr, handle, isarray = False):
529 self.handle = handle
530 self.isarray = isarray
531
532 def __str__(self):
533 return "true" if self.handle else "false"
534
535 def __eq__(self,other):
536 if isinstance(other,Bool):
537 return self.handle == other.value
538 if isinstance(other,bool):
539 return self.handle == other
540 return False
541
542 def __ne__(self,other):
543 if isinstance(other,Bool):
544 return self.handle != other.handle
545 if isinstance(other,bool):
546 return self.handle != other
547 return True
548
549class UnsignedInt:
550 def __init__(self, mgr, handle, isarray = False):
551 self.handle = handle
552 self.isarray = isarray
553
554 def __str__(self):
555 return str(self.handle)
556
557 def __int__(self):
558 return int(self.handle)
559
560 def __next(self):
561 if self.isarray:
562 return self.handle.__next()
563 raise TypeError, "iteration over non-sequence"
564
565 def __size(self):
566 if self.isarray:
567 return self.handle.__size()
568 raise TypeError, "iteration over non-sequence"
569
570 def __len__(self):
571 if self.isarray:
572 return self.handle.__len__()
573 raise TypeError, "iteration over non-sequence"
574
575 def __getitem__(self, index):
576 if self.isarray:
577 return UnsignedInt(self.handle[index])
578 raise TypeError, "iteration over non-sequence"
579
580
581class Int:
582 def __init__(self, mgr, handle, isarray = False):
583 self.handle = handle
584 self.isarray = isarray
585
586 def __next(self):
587 if self.isarray:
588 return self.handle.__next()
589 raise TypeError, "iteration over non-sequence"
590
591 def __size(self):
592 if self.isarray:
593 return self.handle.__size()
594 raise TypeError, "iteration over non-sequence"
595
596 def __len__(self):
597 if self.isarray:
598 return self.handle.__len__()
599 raise TypeError, "iteration over non-sequence"
600
601 def __getitem__(self, index):
602 if self.isarray:
603 return Int(self.handle[index])
604 raise TypeError, "iteration over non-sequence"
605
606 def __str__(self):
607 return str(self.handle)
608
609 def __int__(self):
610 return int(self.handle)
611
612class UnsignedShort:
613 def __init__(self, mgr, handle, isarray = False):
614 self.handle = handle
615 self.isarray = isarray
616
617 def __str__(self):
618 return str(self.handle)
619
620 def __int__(self):
621 return int(self.handle)
622
623class Short:
624 def __init__(self, mgr, handle, isarray = False):
625 self.handle = handle
626
627 def __str__(self):
628 return str(self.handle)
629
630 def __int__(self):
631 return int(self.handle)
632
633class UnsignedLong:
634 def __init__(self, mgr, handle, isarray = False):
635 self.handle = handle
636
637 def __str__(self):
638 return str(self.handle)
639
640 def __int__(self):
641 return int(self.handle)
642
643class Long:
644 def __init__(self, mgr, handle, isarray = False):
645 self.handle = handle
646
647 def __str__(self):
648 return str(self.handle)
649
650 def __int__(self):
651 return int(self.handle)
652
653class Double:
654 def __init__(self, mgr, handle, isarray = False):
655 self.handle = handle
656
657 def __str__(self):
658 return str(self.handle)
659
660 def __int__(self):
661 return int(self.handle)
662
663class Float:
664 def __init__(self, mgr, handle, isarray = False):
665 self.handle = handle
666
667 def __str__(self):
668 return str(self.handle)
669
670 def __int__(self):
671 return int(self.handle)
672
673
674class IUnknown:
675 def __init__(self, mgr, handle, isarray = False):
676 self.handle = handle
677 self.mgr = mgr
678 self.isarray = isarray
679
680 def __next(self):
681 if self.isarray:
682 return self.handle.__next()
683 raise TypeError, "iteration over non-sequence"
684
685 def __size(self):
686 if self.isarray:
687 return self.handle.__size()
688 raise TypeError, "iteration over non-sequence"
689
690 def __len__(self):
691 if self.isarray:
692 return self.handle.__len__()
693 raise TypeError, "iteration over non-sequence"
694
695 def __getitem__(self, index):
696 if self.isarray:
697 return IUnknown(self.mgr, self.handle[index])
698 raise TypeError, "iteration over non-sequence"
699
700 def __str__(self):
701 return str(self.handle)
702
703</xsl:text>
704 <xsl:for-each select="//interface[@wsmap='managed' or @wsmap='global']">
705 <xsl:call-template name="interface"/>
706 </xsl:for-each>
707 <xsl:for-each select="//interface[@wsmap='struct']">
708 <xsl:call-template name="interfacestruct"/>
709 </xsl:for-each>
710 <xsl:for-each select="//collection">
711 <xsl:call-template name="collection"/>
712 </xsl:for-each>
713 <xsl:for-each select="//enum">
714 <xsl:call-template name="enum"/>
715 </xsl:for-each>
716
717class IWebsessionManager2(IWebsessionManager):
718 def __init__(self, url):
719 self.url = url
720 self.port = None
721 self.handle = None
722 self.mgr = self
723
724 def getPort(self):
725 if self.port is None:
726 self.port = vboxServiceLocator().getvboxPortType(self.url)
727 return self.port
728
729</xsl:template>
730
731</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette