~abompard/mailman/sqlalchemy

« back to all changes in this revision

Viewing changes to src/mailman/utilities/importer.py

  • Committer: Abhilash Raj
  • Date: 2014-09-23 09:58:07 UTC
  • mfrom: (7251.1.8 abhilash)
  • Revision ID: raj.abhilash1@gmail.com-20140923095807-8gtsd4gd2duvgzf5
merge updates from to sqlalchemy branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
186
186
    filter_mime_types='filter_types',
187
187
    generic_nonmember_action='default_nonmember_action',
188
188
    include_list_post_header='allow_list_posts',
189
 
    last_post_time='last_post_at',
190
189
    member_moderation_action='default_member_action',
191
190
    mod_password='moderator_password',
192
191
    news_moderation='newsgroup_moderation',
198
197
    send_welcome_msg='send_welcome_message',
199
198
    )
200
199
 
201
 
# Datetime Fields that need a type conversion to python datetime
202
 
# object for SQLite database.
203
 
DATETIME_OBJECTS = [
 
200
# These DateTime fields of the mailinglist table need a type conversion to
 
201
# Python datetime object for SQLite databases.
 
202
DATETIME_COLUMNS = [
204
203
    'created_at',
205
204
    'digest_last_sent_at',
206
205
    'last_post_time',
207
 
]
 
206
    ]
208
207
 
209
208
EXCLUDES = set((
210
209
    'digest_members',
225
224
        # Some attributes must not be directly imported.
226
225
        if key in EXCLUDES:
227
226
            continue
228
 
        # Created at must not be set, it needs a type conversion
229
 
        if key in DATETIME_OBJECTS:
 
227
        # These objects need explicit type conversions.
 
228
        if key in DATETIME_COLUMNS:
230
229
            continue
231
230
        # Some attributes from Mailman 2 were renamed in Mailman 3.
232
231
        key = NAME_MAPPINGS.get(key, key)
249
248
            except (TypeError, KeyError):
250
249
                print('Type conversion error for key "{}": {}'.format(
251
250
                    key, value), file=sys.stderr)
252
 
    for key in DATETIME_OBJECTS:
 
251
    for key in DATETIME_COLUMNS:
253
252
        try:
254
253
            value = datetime.datetime.utcfromtimestamp(config_dict[key])
255
254
        except KeyError: