class Input: connect = Field(maybe(oneof(str, dictof(str, object)))) sql = Field(str) autocommit = Field(bool, default=False) ignore = Field(bool, default=False) @property def sql_key(self): if is_filename(self.sql): return self.sql else: return to_identifier(self.sql) @property def sql_as_filename(self): if is_filename(self.sql): return self.sql @property def sql_as_source(self): if not is_filename(self.sql): return self.sql def __str__(self): return "SQL: %s" % self.sql_key
class Input: uri = Field(str) method = Field(choiceof(['GET', 'POST']), default='GET') remote_user = Field(str, default=None) headers = Field(dictof(str, str), default=None) content_type = Field(str, default=None) content_body = Field(str, default=None) expect = Field(int, default=200)
class Input: db = Field(maybe(oneof(str, dictof(str, object)))) extensions = Field(dictof(str, dictof(str, object)), default={}) save = Field(str, default=None) def __str__(self): if not self.db: return "DB: -" try: from htsql.core.util import DB except ImportError: return "DB: -" try: db = DB.parse(self.db) except ValueError: return "DB: -" db = db.clone(password=None) return "DB: %s" % db
class Input: load = Field(str) extensions = Field(dictof(str, dictof(str, object)), default={}) save = Field(str, default=None)