Example #1
0
 def execute(self, in_args):
     """Execute the action."""
     # in_args is assumed to be tuple of (name, data) all unicode string.
     # the tuple is supposed to be ordered according to in_arg_list
     if len(in_args) != len(self.in_arg_list):
         raise ActionError, "Wrong number of input arguments"
     typed_args = []
     for i in range(len(in_args)):
         name, data = in_args[i]
         in_arg = self.in_arg_list[i]
         if name != in_arg.the_name:
             raise ActionError, "Wrong name/order for input argument"
         try:
             value = upnpmarshal.loads(in_arg.the_type, data)
         except upnpmarshal.MarshalError, why:
             raise ActionError, why
         typed_args.append(value)
Example #2
0
 def execute(self, in_args):
     """Execute the action."""
     # in_args is assumed to be tuple of (name, data) all unicode string.
     # the tuple is supposed to be ordered according to in_arg_list
     if len(in_args) != len(self.in_arg_list):
         raise ActionError, "Wrong number of input arguments"
     typed_args = []
     for i in range(len(in_args)):
         name, data = in_args[i]
         in_arg = self.in_arg_list[i]
         if name != in_arg.the_name:
             raise ActionError, "Wrong name/order for input argument"
         try:
             value = upnpmarshal.loads(in_arg.the_type, data)
         except upnpmarshal.MarshalError, why:
             raise ActionError, why
         typed_args.append(value)
Example #3
0
 def _define_state_variable(self, sv_spec):
     """Define a state variable for the stub. Called as a result of parsing
     the xml service description."""
     try:
         sv_def = {}
         sv_def['name'] = name = sv_spec['name']
         sv_def['upnpType'] = upnp_type = str(sv_spec['dataType'])
         sv_def['pyType'] = upnpmarshal.loads_python_type(upnp_type)
         dvalue = sv_spec['defaultValue']
         if dvalue != None:
             dvalue = upnpmarshal.loads_data_by_upnp_type(upnp_type, dvalue)
         sv_def['defaultValue'] = dvalue
         sv_def['sendEvents'] = upnpmarshal.loads(types.BooleanType,
                                                  sv_spec['sendEvents'])
         self._sv_def_map[name] = sv_def
     except upnpmarshal.MarshalError, why:
         print why
         return
Example #4
0
 def _define_state_variable(self, sv_spec):
     """Define a state variable for the stub. Called as a result of parsing
     the xml service description."""
     try:
         sv_def = {}
         sv_def['name'] = name = sv_spec['name']
         sv_def['upnpType'] = upnp_type = str(sv_spec['dataType'])
         sv_def['pyType'] = upnpmarshal.loads_python_type(upnp_type)
         dvalue = sv_spec['defaultValue']
         if  dvalue != None:
             dvalue = upnpmarshal.loads_data_by_upnp_type(upnp_type, dvalue)
         sv_def['defaultValue'] = dvalue
         sv_def['sendEvents'] = upnpmarshal.loads(types.BooleanType, 
                                                  sv_spec['sendEvents'])
         self._sv_def_map[name] = sv_def    
     except upnpmarshal.MarshalError, why:
         print why
         return