def reportable_region(self, value): if 'reportable_region' in self._lock_attrs: raise AttributeError("can't set attribute") # Confirm the requested region is in the db. if value: connection = DirectAccess(database=self.database, user=self.user, password=self.password) cursor = connection.raw_query("SELECT count(*) FROM "\ "internal_reportable_region "\ "WHERE region_name = '%s'" % value) if cursor.next()[0] < 1: self.error_callback("%s region not found in "\ "internal_reportable_region table" % value) connection.close() self._crit['reportable_region'] = value