Ejemplo n.º 1
0
 def _set_port_range(self, port_range):
     """ validate and set the port range """
     if port_range == '':
         PropertyManager._setPropValue(self, 'port_range', '')
     else:
         self._ports_list(port_range)  # smoke it!
         PropertyManager._setPropValue(self, 'port_range', port_range)
Ejemplo n.º 2
0
    def _setPropValue(self, id, value):
        """ intercept from PropertyManager so we can do validation """

        if type(value) == type(''):
            value = value.strip()

        # mode-relevant props

        # hosts
        if id == 'etc_hosts' and value != self.etc_hosts:
            self._etc_hosts_set(value)
            self._mode_set()

        # domains
        elif id == 'vhost_db' and value != self.vhost_db:
            self._vhost_db_set(value)
            self._mode_set()

        # zopes
        elif id == 'instance_root' and value != self.instance_root:
            self._instance_root_set(value)
            self._mode_set()

        # secondary props

        elif id == 'skel_root' and value != self.skel_root:
            self._skel_root_set(value)
            self._mode_set()
        elif id == 'port_range':
            self._set_port_range(value)
        else:
            PropertyManager._setPropValue(self, id, value)
Ejemplo n.º 3
0
 def _set_vhost_db(self, vhost_db):
     """ validate and set the vhost db"""
     from whichdb import whichdb
     if vhost_db == '':
         PropertyManager._setPropValue(self, 'vhost_db', '')
     elif whichdb(vhost_db) is None or whichdb(vhost_db) == '':
         raise CheezeError, "vhost_db must point to a valid dbm file"
     else:
         clean_path = self._scrub_path(vhost_db)
         PropertyManager._setPropValue(self, 'vhost_db', clean_path)
Ejemplo n.º 4
0
 def _setPropValue(self, id, value):
     """ intercept from PropertyManager so we can do validation """
     if id == 'instance_root':
         self._set_instance_root(value)
     elif id == 'skel_root':
         self._set_skel_root(value)
     elif id == 'vhost_db':
         self._set_vhost_db(value)
     elif id == 'port_range':
         self._set_port_range(value)
     else:
         PropertyManager._setPropValue(self, id, value)
Ejemplo n.º 5
0
 def _set_skel_root(self, skel_root):
     """ validate and set the skel root """
     if skel_root == '':
         PropertyManager._setPropValue(self, 'skel_root', '')
     elif not os.path.exists(skel_root):
         raise CheezeError, "Proposed skel root " \
                          + "'%s' does not exist" % skel_root
     elif not os.path.isdir(skel_root):
         raise CheezeError, "Proposed skel root '%s' " % skel_root \
                          + "does not point to a directory"
     else:
         clean_path = self._scrub_path(skel_root)
         PropertyManager._setPropValue(self, 'skel_root', clean_path)
Ejemplo n.º 6
0
 def _set_instance_root(self, instance_root):
     """ validate and set the instance root """
     if instance_root == '':
         PropertyManager._setPropValue(self, 'instance_root', '')
     elif not os.path.exists(instance_root):
         raise CheezeError, "Proposed instance root " \
                          + "'%s' does not exist" % instance_root
     elif not os.path.isdir(instance_root):
         raise CheezeError, "Proposed instance root " \
                          + "'%s' " % instance_root \
                          + "does not point to a directory"
     else:
         clean_path = self._scrub_path(instance_root)
         PropertyManager._setPropValue(self, 'instance_root', clean_path)
Ejemplo n.º 7
0
 def _etc_hosts_set(self, etc_hosts):
     """ validate and set the etc/hosts path """
     if etc_hosts == '':
         PropertyManager._setPropValue(self, 'etc_hosts', '')
     elif not os.path.exists(etc_hosts):
         raise CheezeError, "Proposed hosts path " \
                          + "'%s' does not exist" % etc_hosts
     elif not os.path.isfile(etc_hosts):
         raise CheezeError, "Proposed hosts path " \
                          + "'%s' " % etc_hosts \
                          + "does not point to a file"
     elif os.path.split(etc_hosts)[1] != 'hosts':
         raise CheezeError, "Proposed hosts file " \
                          + "'%s' " % os.path.split(etc_hosts)[1] \
                          + "is not named 'hosts'"
     else:
         clean_path = self._scrub_path(etc_hosts)
         PropertyManager._setPropValue(self, 'etc_hosts', clean_path)
Ejemplo n.º 8
0
 def _setPropValue(self, id, value):
     """ set a property and invalidate the cache """
     PropertyManager._setPropValue(self, id, value)
     self.ZCacheable_invalidate()
Ejemplo n.º 9
0
 def _set_port_range(self, port_range):
     if port_range == '':
         PropertyManager._setPropValue(self, 'port_range', '')
     else:
         self._ports_list(port_range)  # smoke it!
         PropertyManager._setPropValue(self, 'port_range', port_range)
Ejemplo n.º 10
0
 def _setPropValue(self, id, value):
     PropertyManager._setPropValue(self, id, value)
     self.ZCacheable_invalidate()
Ejemplo n.º 11
0
 def _setPropValue(self, id, value):
     PropertyManager._setPropValue(self, id, value)
     self.ZCacheable_invalidate()