Example #1
0
    def start_server(self, pattern):
        server = self.get_server(pattern)
        if server != None:
            if self.Config.props.shared_path == None:
                d = get_special_dir(SpecialDirType.PUBLIC_SHARE)
                if d == None:
                    self.Config.props.shared_path = os.path.expanduser("~")
                else:
                    self.Config.props.shared_path = d

            if not os.path.isdir(self.Config.props.shared_path):
                raise Exception(
                    "Configured share directory %s does not exist" %
                    self.Config.props.shared_path)

            if pattern == "opp":
                server.Start(self.Config.props.shared_path, True, False)
            elif pattern == "ftp":
                if self.Config.props.ftp_allow_write == None:
                    self.Config.props.ftp_allow_write = False

                server.Start(self.Config.props.shared_path,
                             self.Config.props.ftp_allow_write, True)
            return True
        else:
            return False
Example #2
0
	def start_server(self, pattern):
		server = self.get_server(pattern)
		if server != None:
			if self.Config.props.shared_path == None:
				d = get_special_dir(SpecialDirType.PUBLIC_SHARE)
				if d == None:
					self.Config.props.shared_path = os.path.expanduser("~")
				else:	
					self.Config.props.shared_path = d
			
			if pattern == "opp":
				server.Start(self.Config.props.shared_path, True, False)
			elif pattern == "ftp":
				if self.Config.props.ftp_allow_write == None:
					self.Config.props.ftp_allow_write = False
			
				server.Start(self.Config.props.shared_path, self.Config.props.ftp_allow_write, True)
			return True
		else:
			return False
Example #3
0
    def start_server(self, pattern):
        server = self.get_server(pattern)
        if server != None:
            if self.Config.props.shared_path == None:
                d = get_special_dir(SpecialDirType.PUBLIC_SHARE)
                if d == None:
                    self.Config.props.shared_path = os.path.expanduser("~")
                else:
                    self.Config.props.shared_path = d

            if not os.path.isdir(self.Config.props.shared_path):
                raise Exception("Configured share directory %s does not exist" % self.Config.props.shared_path)

            if pattern == "opp":
                server.Start(self.Config.props.shared_path, True, False)
            elif pattern == "ftp":
                if self.Config.props.ftp_allow_write == None:
                    self.Config.props.ftp_allow_write = False

                server.Start(self.Config.props.shared_path, self.Config.props.ftp_allow_write, True)
            return True
        else:
            return False