- Timestamp:
- Jun 17, 2010 9:34:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r30261 r30280 665 665 return [] 666 666 def matches(self,subexp): 667 # m = re.search(r"@(?P<a>\w+)=(?P<v>\w+)", subexp) 667 if subexp == self.type: 668 return True 669 if not subexp.startswith(self.type): 670 return False 671 m = re.search(r"@(?P<a>\w+)=(?P<v>\w+)", subexp) 668 672 matches = False 669 # try: 670 # if m is not None: 671 # else: 672 # print "no match in ",subexp 673 # except: 674 673 try: 674 if m is not None: 675 dict = m.groupdict() 676 attr = dict['a'] 677 val = dict['v'] 678 matches = (str(getattr(self.obj, attr)) == val) 679 except: 680 pass 675 681 return matches 676 682 def apply(self, cmd): … … 710 716 def __init__(self, parent, obj): 711 717 XPathNode.__init__(self, parent, obj, 'vm') 712 def matches(self,subexp):713 return subexp=='vm'718 #def matches(self,subexp): 719 # return subexp=='vm' 714 720 def enum(self): 715 721 return [XPathNodeHolderNIC(self, self.obj), … … 2793 2799 def foreachCmd(ctx, args): 2794 2800 if len(args) < 3: 2795 print " foreach scope command"2801 print "usage: foreach scope command, where scope is XPath-like expression //vms/vm[@CPUCount='2']" 2796 2802 return 0 2797 2803 … … 2896 2902 'prompt' : ['Control prompt', promptCmd, 0], 2897 2903 'foreachvm' : ['Perform command for each VM', foreachvmCmd, 0], 2898 'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm "print obj.name"', foreachCmd, 0],2904 'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm[@OSTypeId=\'MacOS\'] "print obj.name"', foreachCmd, 0], 2899 2905 } 2900 2906
Note:
See TracChangeset
for help on using the changeset viewer.