Changeset 103 for trunk/dbpickle/dbpickle.py
- Timestamp:
- 05/28/07 13:21:59 (3 years ago)
- Files:
-
- 1 modified
-
trunk/dbpickle/dbpickle.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbpickle/dbpickle.py
r83 r103 6 6 ## Created on Thu Nov 30 00:26:52 2006 7 7 ## by akaihola 8 ## 8 ## 9 9 ## Copyright (C) 2006 Antti Kaihola 10 10 ## This program is free software; you can redistribute it and/or modify … … 12 12 ## the Free Software Foundation; either version 2 of the License, or 13 13 ## (at your option) any later version. 14 ## 14 ## 15 15 ## This program is distributed in the hope that it will be useful, 16 16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of 17 17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 18 ## GNU General Public License for more details. 19 ## 19 ## 20 20 ## You should have received a copy of the GNU General Public License 21 21 ## along with this program; if not, write to the Free Software … … 88 88 # get all many-to-many relation field names for this model 89 89 m2ms = [m2m.name for m2m in meta.many_to_many] 90 90 91 91 for obj in model.objects.all(): 92 92 logging.info('dumping %s.%s %s' % (app, model_name, obj)) 93 93 pk = obj._get_pk_val() 94 94 objects[app, model_name, pk] = obj 95 95 96 96 for m2m in m2ms: 97 97 # store many-to-many related objects for every … … 122 122 for hookname in 'pre_save', 'pre_walk': 123 123 hooks[hookname] = getattr(plugin, '%s_hook' % hookname, lambda obj: False) 124 124 125 125 # unpickle objects and many-to-many relations from disk 126 126 objects, m2m_lists = cPickle.load(file(filepath)) … … 160 160 161 161 meta = obj._meta 162 162 163 163 hooks['pre_walk'](obj) 164 164 for field in meta.fields: … … 177 177 '%(related_app)s.%(related_model)s ' 178 178 '%(related_pk_val)s' % locals()) 179 179 180 180 logging.info('loading %s.%s %s' % ( 181 181 meta.app_label,
