Package brisa :: Package upnp :: Package control_point :: Module action
[hide private]
[frames] | no frames]

Source Code for Module brisa.upnp.control_point.action

 1  # Licensed under the MIT license 
 2  # http://opensource.org/licenses/mit-license.php or see LICENSE file. 
 3  # Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org> 
 4   
 5  """ Control Point side action class used for implementing UPnP actions. 
 6  """ 
 7   
 8  from brisa.upnp.base_action import BaseAction, BaseArgument 
 9   
10   
11 -class Argument(BaseArgument):
12 """ Represents an action argument. 13 """ 14
15 - def __init__(self, arg_name, arg_direction, arg_state_var):
16 """ Constructor for the Argument class. 17 18 @param arg_name: argument name 19 @param arg_direction: argument direction 20 @param arg_state_var: argument related state variable 21 22 @type arg_name: string 23 @type arg_direction: string 24 @type arg_state_var: string 25 """ 26 BaseArgument.__init__(self, arg_name, arg_direction, arg_state_var)
27 28
29 -class Action(BaseAction):
30 """ Represents a service action. 31 """ 32
33 - def __init__(self, service, name, arguments = []):
34 """ Constructor for the Action class. 35 36 @param service: service which holds this action 37 @param name: action name 38 @param arguments: arguments list 39 40 @type service: Service 41 @type name: string 42 @type arguments: list of Argument 43 """ 44 BaseAction.__init__(self, service, name, arguments)
45
46 - def __call__(self, **kwargs):
47 if not self.service._soap_service: 48 raise RuntimeError('Service\'s soap service not created. Maybe '\ 49 'generate_soap_service() was not called.') 50 return self.service._soap_service.call_remote(self.name, **kwargs)
51