Show
Ignore:
Timestamp:
05/28/07 13:21:59 (3 years ago)
Author:
akaihola
Message:

Converted db.py into a module.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/dbpickle/dbpickle.py

    r83 r103  
    66## Created on Thu Nov 30 00:26:52 2006 
    77## by akaihola 
    8 ##  
     8## 
    99## Copyright (C) 2006 Antti Kaihola 
    1010## This program is free software; you can redistribute it and/or modify 
     
    1212## the Free Software Foundation; either version 2 of the License, or 
    1313## (at your option) any later version. 
    14 ##  
     14## 
    1515## This program is distributed in the hope that it will be useful, 
    1616## but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1717## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1818## GNU General Public License for more details. 
    19 ##  
     19## 
    2020## You should have received a copy of the GNU General Public License 
    2121## along with this program; if not, write to the Free Software 
     
    8888        # get all many-to-many relation field names for this model 
    8989        m2ms = [m2m.name for m2m in meta.many_to_many] 
    90          
     90 
    9191        for obj in model.objects.all(): 
    9292            logging.info('dumping %s.%s %s' % (app, model_name, obj)) 
    9393            pk = obj._get_pk_val() 
    9494            objects[app, model_name, pk] = obj 
    95              
     95 
    9696            for m2m in m2ms: 
    9797                # store many-to-many related objects for every 
     
    122122    for hookname in 'pre_save', 'pre_walk': 
    123123        hooks[hookname] = getattr(plugin, '%s_hook' % hookname, lambda obj: False) 
    124      
     124 
    125125    # unpickle objects and many-to-many relations from disk 
    126126    objects, m2m_lists = cPickle.load(file(filepath)) 
     
    160160 
    161161    meta = obj._meta 
    162      
     162 
    163163    hooks['pre_walk'](obj) 
    164164    for field in meta.fields: 
     
    177177                              '%(related_app)s.%(related_model)s ' 
    178178                              '%(related_pk_val)s' % locals()) 
    179                                        
     179 
    180180    logging.info('loading %s.%s %s' % ( 
    181181        meta.app_label,