class WebinterfaceLogs(DBObject): TABLENAME = "webinterface_logs" #### Views #### class ModuleRoutingView(DBObject): TABLENAME = "module_routing_view" Registry.SCHEMAS["PRAGMA_table_info"] = [ "cid", "name", "type", "notnull", "dft_value", "pk" ] Registry.register(Device, DeviceState, VariableData, DeviceType, Command) Registry.register(Modules, ModuleInstalled, ModuleDeviceType) Registry.register(VariableGroups, VariableData) Registry.register(Category) Registry.register(DeviceTypeCommand) Registry.register(Events) Registry.register(EventTypes) #Registry.setDebug(True) TEMP_MODULE_CLASSES = inspect.getmembers(sys.modules[__name__]) MODULE_CLASSES = {} for item in TEMP_MODULE_CLASSES: if isinstance(item, tuple) and len(item) == 2: if inspect.isclass(item[1]): if issubclass(item[1], DBObject): MODULE_CLASSES[item[0]] = item[1]
""" Determine if this object is the same as another (only taking the type of the other class and it's C{id} into account). @param other: The other object to compare this one to. @return: A boolean. """ eqclass = self.__class__.__name__ == other.__class__.__name__ eqid = hasattr(other, '_rowid') and self._rowid == other._rowid return eqclass and eqid def __neq__(self, other): """ Determine if this object is not the same as another (only taking the type of the other class and it's C{id} into account). @param other: The other object to compare this one to. @return: A boolean. """ return not self == other def __hash__(self): return hash('%s.%d' % (type(self).__name__, self._rowid)) __repr__ = __str__ Registry.register(DBObject)
# class Variable(DBObject): # TABLENAME='variables' # BELONGSTO = ['devices', 'modules'] class Sessions(DBObject): TABLENAME='webinterface_sessions' #### Views #### class ModuleRoutingView(DBObject): TABLENAME='module_routing_view' #Registry.register(Config) Registry.SCHEMAS['PRAGMA_table_info'] = ['cid', 'name', 'type', 'notnull', 'dft_value', 'pk'] Registry.register(Device, DeviceStatus, VariableData, DeviceType, Command) Registry.register(Modules, ModuleInstalled) Registry.register(VariableGroups, VariableData) Registry.register(Category) Registry.register(DeviceTypeCommand) TEMP_MODULE_CLASSES = inspect.getmembers(sys.modules[__name__]) MODULE_CLASSES = {} for item in TEMP_MODULE_CLASSES: if isinstance(item, tuple) and len(item) == 2 : if inspect.isclass(item[1]): if issubclass(item[1], DBObject): MODULE_CLASSES[item[0]] = item[1] del TEMP_MODULE_CLASSES
@param other: The other object to compare this one to. @return: A boolean. """ eqclass = self.__class__.__name__ == other.__class__.__name__ eqid = hasattr(other, '_rowid') and self._rowid == other._rowid return eqclass and eqid def __neq__(self, other): """ Determine if this object is not the same as another (only taking the type of the other class and it's C{id} into account). @param other: The other object to compare this one to. @return: A boolean. """ return not self == other def __hash__(self): return hash('%s.%d' % (type(self).__name__, self.id)) __repr__ = __str__ Registry.register(DBObject)