diff options
| author | Barry Warsaw | 2011-10-22 19:35:23 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-10-22 19:35:23 -0400 |
| commit | 46fc401a90d31b0f6b89821a002807f893cea2cf (patch) | |
| tree | 0d1a5c4337520344d9e2eca2d543c60ca86cd233 /src/mailman/database/base.py | |
| parent | 759d36cd7c488fc59548fa8a099e9e9009132504 (diff) | |
| download | mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.tar.gz mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.tar.zst mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.zip | |
Diffstat (limited to 'src/mailman/database/base.py')
| -rw-r--r-- | src/mailman/database/base.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py index 1c41a2fba..37fe35eb9 100644 --- a/src/mailman/database/base.py +++ b/src/mailman/database/base.py @@ -42,6 +42,8 @@ from mailman.utilities.string import expand log = logging.getLogger('mailman.config') +NL = '\n' + class StormBaseDatabase: @@ -123,8 +125,13 @@ class StormBaseDatabase: # exists. If so, then we assume the database schema is correctly # initialized. Storm does not currently provide schema creation. if not self._database_exists(store): - # Initialize the database. - for statement in self._get_schema().split(';'): + # Initialize the database. Start by getting the schema and + # discarding all blank and comment lines. + lines = self._get_schema().splitlines() + lines = (line for line in lines + if line.strip() != '' and line.strip()[:2] != '--') + sql = NL.join(lines) + for statement in sql.split(';'): if statement.strip() != '': store.execute(statement + ';') # Validate schema version. |
