Ignore:
Timestamp:
05.07.2010 21:26:11 (23 months ago)
Author:
zmsdev
Message:

Applied fix for auto-initialization of catalog-object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/_zcatalogmanager.py

    r1047 r1084  
    128128  cat_id = 'catalog_%s'%lang 
    129129  obs = filter( lambda x: x.id==cat_id, context.objectValues( [ 'ZCatalog'])) 
    130   if len(obs) == 0: 
    131     catalog = getattr( self, cat_id, None) 
    132     if catalog is not None and catalog.meta_type == 'ZCatalog': 
    133       obs = [catalog] 
    134   if len(obs) == 0: 
    135     return self.recreateCatalog(lang) 
    136   return obs[0] 
     130  if obs: 
     131    return obs[0] 
     132  else: 
     133    return getattr( self, cat_id, None) 
    137134 
    138135 
     
    503500       
    504501      #-- Get catalog 
    505       cat_id = 'catalog_%s'%lang 
    506       obs = filter( lambda x: x.id==cat_id, context.objectValues( [ 'ZCatalog'])) 
    507       if len(obs) == 0: 
    508         catalog = getattr( self, cat_id, None) 
    509         if catalog is not None and catalog.meta_type == 'ZCatalog': 
    510           obs = [catalog] 
    511       if len( obs) == 0: 
     502      zcatalog = getCatalog( self, lang) 
     503      if zcatalog is None: 
     504        cat_id = 'catalog_%s'%lang 
    512505        cat_title = 'Default catalog' 
    513506        vocab_id = 'create_default_catalog_' 
    514507        zcatalog = ZCatalog.ZCatalog(cat_id, cat_title, vocab_id, context) 
    515508        context._setObject(zcatalog.id, zcatalog) 
    516         zcatalog = getCatalog(self,lang) 
    517       else: 
    518         zcatalog = obs[ 0] 
     509        zcatalog = getCatalog( self, lang) 
    519510       
    520511      #-- Add lexicon 
     
    689680      lang = REQUEST['lang'] 
    690681      zcatalog = getCatalog(self,lang) 
     682      if zcatalog is None: 
     683        return rtn 
    691684      items = [] 
    692685      for zcindex in zcatalog.indexes(): 
Note: See TracChangeset for help on using the changeset viewer.