Changeset 2289 for WAeUP_SRP/base


Ignore:
Timestamp:
28 Sep 2007, 08:54:17 (17 years ago)
Author:
joachim
Message:

use WAeUPId Widget for Ids

Location:
WAeUP_SRP/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2288 r2289  
    10321032        res = self.portal_catalog(id=course_id)
    10331033        if not res:
    1034             return '', "No Course with ID: %s" % did
     1034            return '', "No Course with ID: %s" % course_id
    10351035        c = res[0].getObject()
    10361036        c.getContent().edit(mapping=mapping)
     
    13681368            validators[widget] = layout[widget].validate
    13691369        #import pdb;pdb.set_trace()
     1370        mode = "create"
    13701371        if edit:
    1371             importer_name = "mass_edit_%s" % name
    1372         else:
    1373             importer_name = "mass_create_%s" % name
     1372            mode = "edit"
     1373        importer_name = "mass_%(mode)s_%(name)s" % vars()
    13741374        importer = getattr(self, '%s' % importer_name,None)
    13751375        if importer is None:
     
    14101410            for k in import_keys:
    14111411                #import pdb;pdb.set_trace()
    1412                 if not validators[k](ds):
     1412                if not validators[k](ds,mode=mode):
    14131413                    error_string += " %s : %s" % (k,
    14141414                                                  self.translation_service(ds.getError(k),
  • WAeUP_SRP/base/Widgets.py

    r2282 r2289  
    624624    def validate(self, datastructure, **kw):
    625625        """Validate datastructure and update datamodel."""
    626 
     626        mode = kw.get('mode','create')
    627627        valid = CPSStringWidget.validate(self, datastructure, **kw)
    628628        id_pat_str = r"\S"
     
    642642            if len(value.split()) > 1:
    643643                err = 'Invalid Id, Id contains space(s).'
    644             elif self.portal_catalog(portal_type=portal_type_query,id=value):
     644            elif mode == "create" and\
     645                          self.portal_catalog(portal_type=portal_type_query,id=value):
    645646                brain = self.portal_catalog(portal_type=portal_type_query,id=value)[0]
    646647                err = 'An ${portal_type} object with the Id ${id} already exists at ${path}.'
Note: See TracChangeset for help on using the changeset viewer.