Пример #1
0
	def put( self , path , file ) :
		'''
		send file at given path 

		can rise ValueError if path is invalid
		'''
		assert( self.con != None )

		cont , obj = os.path.split(path)

		if obj == '' :
			raise ValueError('cannot put file with empty name')

		self.get(cont)

		try :
			self.con.put_object(fs2sw(cont),obj,file.contents())
		except scc.ClientException as e :
			if e.http_status == 401 :
				raise OperationNotPermitted('get '+path)
			if e.http_status == 404 :
				raise NoSuchFileOrDirectory(cont)
			else : raise UnknownError(e)
Пример #2
0
 def _checkCwd(self):
     expected = File.contents(self.dirize('cwd'))
     if os.getcwd() != expected:
         raise InvalidCwd(expected)