def getGui(self, type_: str) -> typing.List[typing.Any]: try: tgui = auths.factory().lookup(type_) if tgui: g = self.addDefaultFields( tgui.guiDescription(), ['name', 'comments', 'tags', 'priority', 'small_name']) self.addField( g, { 'name': 'visible', 'value': True, 'label': ugettext('Visible'), 'tooltip': ugettext( 'If active, transport will be visible for users'), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 107, 'tab': ugettext('Display'), }) return g raise Exception() # Not found except Exception: raise NotFound('type not found')
def getTypes( self, parent: 'Provider', forType: typing.Optional[str] ) -> typing.Iterable[typing.Dict[str, typing.Any]]: logger.debug('getTypes parameters: %s, %s', parent, forType) offers: typing.List[typing.Dict[str, typing.Any]] if forType is None: offers = [{ 'name': _(t.name()), 'type': t.type(), 'description': _(t.description()), 'icon': t.icon64().replace('\n', '') } for t in parent.getType().getServicesTypes()] else: for t in parent.getType().getServicesTypes(): if forType == t.type(): offers = [{ 'name': _(t.name()), 'type': t.type(), 'description': _(t.description()), 'icon': t.icon64().replace('\n', '') }] break if offers: raise NotFound('type not found') return offers # Default is that details do not have types
def getGui(self, type_): try: return self.addDefaultFields( factory().lookup(type_).guiDescription(), ['name', 'comments', 'tags']) except: raise NotFound('type not found')
def getGui(self, type_): try: return self.addDefaultFields( auths.factory().lookup(type_).guiDescription(), ['name', 'comments', 'tags', 'priority', 'small_name']) except Exception: raise NotFound('type not found')
def getGui(self, type_: str) -> typing.List[typing.Any]: try: return self.addDefaultFields( osmanagers.factory().lookup(type_).guiDescription(), ['name', 'comments', 'tags']) except: raise NotFound('type not found')
def get(self): if len(self._args) != 1: raise RequestError('Invalid Request') if self._args[0] in gui.callbacks: return gui.callbacks[self._args[0]](self._params) raise NotFound('callback {0} not found'.format(self._args[0]))
def getGui(self, type_: str) -> typing.List[typing.Any]: try: gui = auths.factory().lookup(type_) if gui: return self.addDefaultFields( gui.guiDescription(), ['name', 'comments', 'tags', 'priority', 'small_name']) raise Exception() # Not found except Exception: raise NotFound('type not found')
def getTypes(self, parent, forType): logger.debug('getTypes parameters: {0}, {1}'.format(parent, forType)) if forType is None: offers = [{ 'name': _(t.name()), 'type': t.type(), 'description': _(t.description()), 'icon': t.icon().replace('\n', '')} for t in parent.getType().getServicesTypes()] else: offers = None # Do we really need to get one specific type? for t in parent.getType().getServicesTypes(): if forType == t.type(): offers = t break if offers is None: raise NotFound('type not found') return offers # Default is that details do not have types
def test(self, type_: str): from uds.core.environment import Environment logger.debug('Type: %s', type_) spType = services.factory().lookup(type_) if not spType: raise NotFound('Type not found!') tmpEnvironment = Environment.getTempEnv() logger.debug('spType: %s', spType) dct = self._params.copy() dct['_request'] = self._request res = spType.test(tmpEnvironment, dct) if res[0]: return 'ok' return res[1]
def test(self, type_: str): from uds.core.environment import Environment logger.debug('Type: %s', type_) spType = services.factory().lookup(type_) if not spType: raise NotFound('Type not found!') self.ensureAccess(spType, permissions.PERMISSION_MANAGEMENT, root=True) logger.debug('spType: %s', spType) dct = self._params.copy() dct['_request'] = self._request res = spType.test(Environment.getTempEnv(), dct) if res[0]: return 'ok' return res[1]
def getGui(self, type_: str) -> typing.List[typing.Any]: clsType = services.factory().lookup(type_) if clsType: return self.addDefaultFields(clsType.guiDescription(), ['name', 'comments', 'tags']) raise NotFound('Type not found!')