|
|
|
@ -73,11 +73,11 @@ class _Settings(_Base):
|
|
|
|
|
config_default_role = Column(SmallInteger, default=0)
|
|
|
|
|
config_default_show = Column(SmallInteger, default=6143)
|
|
|
|
|
config_columns_to_ignore = Column(String)
|
|
|
|
|
config_restricted_tags = Column(String)
|
|
|
|
|
config_allowed_tags = Column(String)
|
|
|
|
|
config_restricted_tags = Column(String, default="")
|
|
|
|
|
config_allowed_tags = Column(String, default="")
|
|
|
|
|
config_restricted_column = Column(SmallInteger, default=0)
|
|
|
|
|
config_restricted_column_value = Column(String)
|
|
|
|
|
config_allowed_column_value = Column(String)
|
|
|
|
|
config_restricted_column_value = Column(String, default="")
|
|
|
|
|
config_allowed_column_value = Column(String, default="")
|
|
|
|
|
|
|
|
|
|
config_use_google_drive = Column(Boolean, default=False)
|
|
|
|
|
config_google_drive_folder = Column(String)
|
|
|
|
@ -111,6 +111,9 @@ class _Settings(_Base):
|
|
|
|
|
|
|
|
|
|
config_updatechannel = Column(Integer, default=constants.UPDATE_STABLE)
|
|
|
|
|
|
|
|
|
|
config_reverse_proxy_login_header_name = Column(String)
|
|
|
|
|
config_allow_reverse_proxy_header_login = Column(Boolean, default=False)
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return self.__class__.__name__
|
|
|
|
|
|
|
|
|
@ -264,8 +267,7 @@ class _ConfigSQL(object):
|
|
|
|
|
for k, v in self.__dict__.items():
|
|
|
|
|
if k[0] == '_':
|
|
|
|
|
continue
|
|
|
|
|
if hasattr(s, k): # and getattr(s, k, None) != v:
|
|
|
|
|
# log.debug("_Settings save '%s' = %r", k, v)
|
|
|
|
|
if hasattr(s, k):
|
|
|
|
|
setattr(s, k, v)
|
|
|
|
|
|
|
|
|
|
log.debug("_ConfigSQL updating storage")
|
|
|
|
@ -288,12 +290,18 @@ def _migrate_table(session, orm_class):
|
|
|
|
|
try:
|
|
|
|
|
session.query(column).first()
|
|
|
|
|
except exc.OperationalError as err:
|
|
|
|
|
log.debug("%s: %s", column_name, err)
|
|
|
|
|
log.debug("%s: %s", column_name, err.args[0])
|
|
|
|
|
if column.default is not None:
|
|
|
|
|
if sys.version_info < (3, 0):
|
|
|
|
|
if isinstance(column.default.arg,unicode):
|
|
|
|
|
column.default.arg = column.default.arg.encode('utf-8')
|
|
|
|
|
column_default = "" if column.default is None else ("DEFAULT %r" % column.default.arg)
|
|
|
|
|
if column.default is None:
|
|
|
|
|
column_default = ""
|
|
|
|
|
else:
|
|
|
|
|
if isinstance(column.default.arg, bool):
|
|
|
|
|
column_default = ("DEFAULT %r" % int(column.default.arg))
|
|
|
|
|
else:
|
|
|
|
|
column_default = ("DEFAULT %r" % column.default.arg)
|
|
|
|
|
alter_table = "ALTER TABLE %s ADD COLUMN `%s` %s %s" % (orm_class.__tablename__,
|
|
|
|
|
column_name,
|
|
|
|
|
column.type,
|
|
|
|
|