[Zope] SOLUTION -- Products have incorrect "home" attribute

George Lee georgeleejr at gmail.com
Fri Jan 20 00:32:57 EST 2006


> After migrating to a new server, several of my Zope products have an
> incorrect "home" attribute that specifies where they live on the
> filesystem. However, when I try to change these attributes using an
> external method, the attributes do not change. Any help?
> 
> Peace,
> George


Turns out it was a bug in my external method, writing == instead of =, that
tripped me up. This is the external method I used:



OLD_INSTANCE_PROD_DIR_LIST = [
   '/home/BLUH1/zope/instance1/Products/',
   '/home/BLUH2/zope/instance1/Products/',
   ]
NEW_INSTANCE_PROD_DIR = '/usr/local/zope/instance1/Products/'

OLD_PYTHON_PROD_DIR_LIST = [
   '/usr/home/BLUH3/zope/270/lib/python/Products/',
   '/home/BLUH4/zope/273/lib/python/Products/',
   '/home/BLUH5/zope/281/lib/python/Products/',
   ]
NEW_PYTHON_PROD_DIR = '/usr/local/zope/284/lib/python/Products/'

def listHome(self):
   prods = self.Control_Panel.Products
   listBefore = []
   listAfter = []

   for p in prods.objectIds():
      homeBefore = prods._getOb(p).home
      listBefore = listBefore + [homeBefore]
      if homeBefore in map( lambda x : x + p, OLD_INSTANCE_PROD_DIR_LIST ):
         prods._getOb(p).home = NEW_INSTANCE_PROD_DIR + p
      elif homeBefore in map( lambda x : x + p, OLD_PYTHON_PROD_DIR_LIST ):
         prods._getOb(p).home = NEW_PYTHON_PROD_DIR + p
      listAfter = listAfter + [prods._getOb(p).home]

   return "Before: %s\n\nAfter: %s" % (str(listBefore),str(listAfter))



More information about the Zope mailing list