Exemple #1
0
    def clients_dir(self, value):
        """Assigns new value to clients_dir property if possible."""
        if value is None:
            self.settings['server']['clients_dir'] = None
            return

        if not os.path.isdir(value):
            _helper.create_directory(value)

        status = os.path.isdir(value)

        if not status:
            print(
                "Value that you specified as directory for clients is invalid: ("
                + value + ")")
            print(
                'Make sure that the value you gave meets following requirements:'
            )
            print('> Does the directory really exist in your filesystem?')
            print(
                '> The specified directory has write and execute permissions.')
            exit(1)

        self.settings['server']['clients_dir'] = _helper.sanitize_path(value)
Exemple #2
0
 def client_dir(self, create=True):
     """Assigns new value to client_dir property and creates directory for it if needed."""
     value = self.clients_dir + self.slug
     if create:
         _helper.create_directory(value)
     self.settings['client']['client_dir'] = _helper.sanitize_path(value)