def import_service(self, base, servicedir): service = DataObject() sys.path.insert(0, base) module = __import__(servicedir) sys.path.remove(base) service_data = module.init() service.ServiceClass = service_data['service_class'] service.name = service_data.get('name', servicedir) service.title = service_data.get('title') service.version = service_data.get('version') service.model = service_data.get('model') service.obj = service.ServiceClass() service.status = 'Running' service.started = datetime.now() service.methods = [] for m in dir(service.obj): member = getattr(service.obj, m) if 'webmethodtype' in dir(member): t = member.__dict__['webmethodtype'] service.methods.append(m) member = expose(member) return service