Fix for #1530 (Handle improper migrated database with config_mature_content_tags NULL instead of "")
This commit is contained in:
parent
450411a732
commit
93a0217d5f
|
@ -102,7 +102,6 @@ class _Settings(_Base):
|
|||
|
||||
config_kobo_proxy = Column(Boolean, default=False)
|
||||
|
||||
|
||||
config_ldap_provider_url = Column(String, default='example.org')
|
||||
config_ldap_port = Column(SmallInteger, default=389)
|
||||
config_ldap_authentication = Column(SmallInteger, default=constants.LDAP_AUTH_SIMPLE)
|
||||
|
@ -215,8 +214,13 @@ class _ConfigSQL(object):
|
|||
return self.show_element_new_user(constants.DETAIL_RANDOM)
|
||||
|
||||
def list_denied_tags(self):
|
||||
mct = self.config_denied_tags.split(",")
|
||||
return [t.strip() for t in mct]
|
||||
try:
|
||||
mct = self.config_denied_tags.split(",")
|
||||
return [t.strip() for t in mct]
|
||||
except AttributeError:
|
||||
# Fix for improper migrated database with config_mature_content_tags NULL instead of ""
|
||||
self.config_denied_tags = ""
|
||||
return ['']
|
||||
|
||||
def list_allowed_tags(self):
|
||||
mct = self.config_allowed_tags.split(",")
|
||||
|
|
14
cps/ub.py
14
cps/ub.py
|
@ -176,8 +176,14 @@ class UserBase:
|
|||
return self.check_visibility(constants.DETAIL_RANDOM)
|
||||
|
||||
def list_denied_tags(self):
|
||||
mct = self.denied_tags.split(",")
|
||||
return [t.strip() for t in mct]
|
||||
try:
|
||||
mct = self.denied_tags.split(",")
|
||||
return [t.strip() for t in mct]
|
||||
except AttributeError:
|
||||
# Fix for improper migrated database with config_mature_content_tags NULL instead of ""
|
||||
self.denied_tags=""
|
||||
return ['']
|
||||
|
||||
|
||||
def list_allowed_tags(self):
|
||||
mct = self.allowed_tags.split(",")
|
||||
|
@ -563,8 +569,8 @@ def migrate_Database(session):
|
|||
conn = engine.connect()
|
||||
conn.execute("ALTER TABLE user ADD column `denied_tags` String DEFAULT ''")
|
||||
conn.execute("ALTER TABLE user ADD column `allowed_tags` String DEFAULT ''")
|
||||
conn.execute("ALTER TABLE user ADD column `denied_column_value` DEFAULT ''")
|
||||
conn.execute("ALTER TABLE user ADD column `allowed_column_value` DEFAULT ''")
|
||||
conn.execute("ALTER TABLE user ADD column `denied_column_value` String DEFAULT ''")
|
||||
conn.execute("ALTER TABLE user ADD column `allowed_column_value` String DEFAULT ''")
|
||||
session.commit()
|
||||
try:
|
||||
session.query(exists().where(User.series_view)).scalar()
|
||||
|
|
Loading…
Reference in New Issue
Block a user