Changeset 3250 for WAeUP_SRP


Ignore:
Timestamp:
28 Feb 2008, 09:33:58 (17 years ago)
Author:
joachim
Message:

fix for #93

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPImport.py

    r3249 r3250  
    7070        self.courses_catalog = waeup_tool.courses_catalog
    7171        self.course_results = waeup_tool.course_results
     72        self.applicants_catalog = waeup_tool.applicants_catalog
    7273        #self.mode = mode
    7374        # self.import_method = getattr(self, '%s' % mode,None)
     
    8485        self.logger = logging.getLogger('WAeUPImport.%sImport' % self.plural_name.capitalize())
    8586        self.schema = self.schema_tool._getOb(iname,None)
    86         self.pending_schema = self.schema_tool._getOb("%s_pending" % iname,None)
     87        #self.pending_schema = self.schema_tool._getOb("%s_pending" % iname,None)
    8788        self.layout = self.layout_tool._getOb(iname,None)
    88         if self.schema is None:
    89             errors.append('no schema %s' % iname)
    90         if self.pending_schema is None:
    91             self.pending_schema = self.schema
    92         if self.layout is None:
    93             errors.append('no such layout %s' % iname)
    94         self.data_keys = self.pending_schema.keys()
    95         self.csv_keys = self.pending_schema.keys()
    96         info = {}
    97         info['imported_from'] = ''
    98         info['imported_by'] = str(member)
    99         info['import_date'] = self.import_date
    100         #info['import_mode'] = mode #now in import_xxx schema + layout
    101         info['error'] = ''
    102         #info['digest'] = ''
    103         self.info = info
    104         self.csv_keys.extend(self.info)
    105         self.validators = {}
    106         for widget in self.layout.keys():
    107             self.validators[widget] = self.layout[widget].validate
    108         self.required_keys = {}
    109         for mode in self.required_modes:
    110             self.required_keys[mode] = [self.layout.getIdUnprefixed(id)
    111                                 for id,widget in self.layout.objectItems()
    112                                 if widget.is_required]
     89        while True:
     90            if self.schema is None:
     91                errors.append('no schema %s' % iname)
     92            # if self.pending_schema is None:
     93            #     self.pending_schema = self.schema
     94            if self.layout is None:
     95                errors.append('no such layout %s' % iname)
     96            if errors:
     97                break
     98            self.data_keys = self.schema.keys()
     99            self.csv_keys = self.schema.keys()
     100            info = {}
     101            info['imported_from'] = ''
     102            info['imported_by'] = str(member)
     103            info['import_date'] = self.import_date
     104            info['error'] = ''
     105            self.info = info
     106            self.csv_keys.extend(self.info)
     107            self.validators = {}
     108            for widget in self.layout.keys():
     109                self.validators[widget] = self.layout[widget].validate
     110            self.required_keys = {}
     111            for mode in self.required_modes:
     112                self.required_keys[mode] = [self.layout.getIdUnprefixed(id)
     113                                    for id,widget in self.layout.objectItems()
     114                                    if widget.is_required]
     115            break
    113116        self.init_errors = ','.join(errors)
    114117
     
    134137
    135138class ApplicationImport(WAeUPImport):###(
    136     name = "applications"
     139    name = "application"
    137140    plural_name = "%ss" % name
    138141    commit_after = 1000
Note: See TracChangeset for help on using the changeset viewer.