vbox的更動 59795 路徑 trunk/src/VBox/Main
- 時間撮記:
- 2016-2-24 上午09:13:27 (9 年 以前)
- 位置:
- trunk/src/VBox/Main
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/glue/vboxapi.py
r59769 r59795 7 7 __copyright__ = \ 8 8 """ 9 Copyright (C) 2009-201 6Oracle Corporation9 Copyright (C) 2009-2015 Oracle Corporation 10 10 11 11 This file is part of VirtualBox Open Source Edition (OSE), as … … 32 32 xrange = range 33 33 long = int 34 import builtins 35 print_ = getattr(builtins, 'print', None) 36 elif sys.version_info >= (2, 6): 37 import __builtin__ 38 print_ = getattr(__builtin__, 'print', None) 39 else: 40 def print_(*args, **kwargs): 41 """The new-style print function for Python 2.4 and 2.5.""" 42 fp = kwargs.pop("file", sys.stdout) 43 if fp is None: 44 return 45 46 def write(data): 47 if not isinstance(data, basestring): 48 data = str(data) 49 # If the file has an encoding, encode unicode with it. 50 if isinstance(fp, file) and isinstance(data, unicode) and fp.encoding is not None: 51 errors = getattr(fp, "errors", None) 52 if errors is None: 53 errors = "strict" 54 data = data.encode(fp.encoding, errors) 55 fp.write(data) 56 57 want_unicode = False 58 sep = kwargs.pop("sep", None) 59 if sep is not None: 60 if isinstance(sep, unicode): 61 want_unicode = True 62 elif not isinstance(sep, str): 63 raise TypeError("sep must be None or a string") 64 end = kwargs.pop("end", None) 65 if end is not None: 66 if isinstance(end, unicode): 67 want_unicode = True 68 elif not isinstance(end, str): 69 raise TypeError("end must be None or a string") 70 if kwargs: 71 raise TypeError("invalid keyword arguments to print()") 72 if not want_unicode: 73 for arg in args: 74 if isinstance(arg, unicode): 75 want_unicode = True 76 break 77 if want_unicode: 78 newline = unicode("\n") 79 space = unicode(" ") 80 else: 81 newline = "\n" 82 space = " " 83 if sep is None: 84 sep = space 85 if end is None: 86 end = newline 87 for i, arg in enumerate(args): 88 if i: 89 write(sep) 90 write(arg) 91 write(end) 34 92 35 93 # … … 167 225 # Try case-insensitivity workaround for class attributes (COM methods). 168 226 sAttrLower = sAttr.lower() 169 for k in list(self.__class__.__dict__.keys()):227 for k in self.__class__.__dict__.keys(): 170 228 if k.lower() == sAttrLower: 171 229 setattr(self.__class__, sAttr, self.__class__.__dict__[k]) -
trunk/src/VBox/Main/webservice/websrv-python.xsl
r59769 r59795 193 193 if self.isarray: 194 194 return self.handle.__next() 195 raise TypeError ("iteration over non-sequence")195 raise TypeError, "iteration over non-sequence" 196 196 197 197 def __size(self): 198 198 if self.isarray: 199 199 return self.handle.__size() 200 raise TypeError ("iteration over non-sequence")200 raise TypeError, "iteration over non-sequence" 201 201 202 202 def __len__(self): 203 203 if self.isarray: 204 204 return self.handle.__len__() 205 raise TypeError ("iteration over non-sequence")205 raise TypeError, "iteration over non-sequence" 206 206 207 207 def __getitem__(self, index): 208 208 if self.isarray: 209 209 return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index]) 210 raise TypeError ("iteration over non-sequence")210 raise TypeError, "iteration over non-sequence" 211 211 212 212 def __str__(self): … … 326 326 327 327 def <xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self): 328 raise Error ('setters not supported')328 raise Error, 'setters not supported' 329 329 </xsl:for-each> 330 330 … … 332 332 if self.isarray: 333 333 return self.handle.__next() 334 raise TypeError ("iteration over non-sequence")334 raise TypeError, "iteration over non-sequence" 335 335 336 336 def __size(self): 337 337 if self.isarray: 338 338 return self.handle.__size() 339 raise TypeError ("iteration over non-sequence")339 raise TypeError, "iteration over non-sequence" 340 340 341 341 def __len__(self): 342 342 if self.isarray: 343 343 return self.handle.__len__() 344 raise TypeError ("iteration over non-sequence")344 raise TypeError, "iteration over non-sequence" 345 345 346 346 def __getitem__(self, index): 347 347 if self.isarray: 348 348 return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index]) 349 raise TypeError ("iteration over non-sequence")349 raise TypeError, "iteration over non-sequence" 350 350 <xsl:call-template name="xsltprocNewlineOutputHack"/> 351 351 </xsl:template> … … 511 511 c = self.map.get(handle,-1) 512 512 if c == -1: 513 raise Error ('wrong refcount')513 raise Error, 'wrong refcount' 514 514 c = c - 1 515 515 if c == 0: … … 533 533 if self.isarray: 534 534 return self.handle.__next() 535 raise TypeError ("iteration over non-sequence")535 raise TypeError, "iteration over non-sequence" 536 536 537 537 def __size(self): 538 538 if self.isarray: 539 539 return self.handle.__size() 540 raise TypeError ("iteration over non-sequence")540 raise TypeError, "iteration over non-sequence" 541 541 542 542 def __len__(self): 543 543 if self.isarray: 544 544 return self.handle.__len__() 545 raise TypeError ("iteration over non-sequence")545 raise TypeError, "iteration over non-sequence" 546 546 547 547 def __getitem__(self, index): 548 548 if self.isarray: 549 549 return String(self.mgr, self.handle[index]) 550 raise TypeError ("iteration over non-sequence")550 raise TypeError, "iteration over non-sequence" 551 551 552 552 def __str__(self): … … 624 624 if self.isarray: 625 625 return self.handle.__next() 626 raise TypeError ("iteration over non-sequence")626 raise TypeError, "iteration over non-sequence" 627 627 628 628 def __size(self): 629 629 if self.isarray: 630 630 return self.handle.__size() 631 raise TypeError ("iteration over non-sequence")631 raise TypeError, "iteration over non-sequence" 632 632 633 633 def __len__(self): 634 634 if self.isarray: 635 635 return self.handle.__len__() 636 raise TypeError ("iteration over non-sequence")636 raise TypeError, "iteration over non-sequence" 637 637 638 638 def __getitem__(self, index): 639 639 if self.isarray: 640 640 return Boolean(self.mgr, self.handle[index]) 641 raise TypeError ("iteration over non-sequence")641 raise TypeError, "iteration over non-sequence" 642 642 643 643 class Number: … … 650 650 if self.isarray: 651 651 return self.handle.__next() 652 raise TypeError ("iteration over non-sequence")652 raise TypeError, "iteration over non-sequence" 653 653 654 654 def __size(self): 655 655 if self.isarray: 656 656 return self.handle.__size() 657 raise TypeError ("iteration over non-sequence")657 raise TypeError, "iteration over non-sequence" 658 658 659 659 def __len__(self): 660 660 if self.isarray: 661 661 return self.handle.__len__() 662 raise TypeError ("iteration over non-sequence")662 raise TypeError, "iteration over non-sequence" 663 663 664 664 def __str__(self): … … 711 711 self.handle = mgr.decodebase64(handle) 712 712 else: 713 raise TypeError ("only octet arrays")713 raise TypeError, "only octet arrays" 714 714 715 715 def __getitem__(self, index): … … 731 731 if self.isarray: 732 732 return UnsignedInt(self.mgr, self.handle[index]) 733 raise TypeError ("iteration over non-sequence")733 raise TypeError, "iteration over non-sequence" 734 734 735 735 … … 743 743 if self.isarray: 744 744 return Int(self.mgr, self.handle[index]) 745 raise TypeError ("iteration over non-sequence")745 raise TypeError, "iteration over non-sequence" 746 746 747 747 class UnsignedShort(Number): … … 754 754 if self.isarray: 755 755 return UnsignedShort(self.mgr, self.handle[index]) 756 raise TypeError ("iteration over non-sequence")756 raise TypeError, "iteration over non-sequence" 757 757 758 758 class Short(Number): … … 765 765 if self.isarray: 766 766 return Short(self.mgr, self.handle[index]) 767 raise TypeError ("iteration over non-sequence")767 raise TypeError, "iteration over non-sequence" 768 768 769 769 class UnsignedLong(Number): … … 776 776 if self.isarray: 777 777 return UnsignedLong(self.mgr, self.handle[index]) 778 raise TypeError ("iteration over non-sequence")778 raise TypeError, "iteration over non-sequence" 779 779 780 780 class Long(Number): … … 787 787 if self.isarray: 788 788 return Long(self.mgr, self.handle[index]) 789 raise TypeError ("iteration over non-sequence")789 raise TypeError, "iteration over non-sequence" 790 790 791 791 class Double(Number): … … 798 798 if self.isarray: 799 799 return Double(self.mgr, self.handle[index]) 800 raise TypeError ("iteration over non-sequence")800 raise TypeError, "iteration over non-sequence" 801 801 802 802 class Float(Number): … … 809 809 if self.isarray: 810 810 return Float(self.mgr, self.handle[index]) 811 raise TypeError ("iteration over non-sequence")811 raise TypeError, "iteration over non-sequence" 812 812 813 813 class IUnknown: … … 826 826 if self.isarray: 827 827 return self.handle.__next() 828 raise TypeError ("iteration over non-sequence")828 raise TypeError, "iteration over non-sequence" 829 829 830 830 def __size(self): 831 831 if self.isarray: 832 832 return self.handle.__size() 833 raise TypeError ("iteration over non-sequence")833 raise TypeError, "iteration over non-sequence" 834 834 835 835 def __len__(self): 836 836 if self.isarray: 837 837 return self.handle.__len__() 838 raise TypeError ("iteration over non-sequence")838 raise TypeError, "iteration over non-sequence" 839 839 840 840 def __getitem__(self, index): 841 841 if self.isarray: 842 842 return IUnknown(self.mgr, self.handle[index]) 843 raise TypeError ("iteration over non-sequence")843 raise TypeError, "iteration over non-sequence" 844 844 845 845 def __str__(self):
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器