def create(self, obj, **kwargs): if not self.exists( obj, **kwargs ): rods_path = self.__get_rods_path( obj, **kwargs ) log.debug( 'create(): %s', rods_path ) dir_only = kwargs.get( 'dir_only', False ) # short circuit collection creation since most of the time it will # be the root collection which already exists collection_path = rods_path if dir_only else path_dirname( rods_path ) if collection_path != self.root_collection_path: self.__mkcolls( collection_path ) if not dir_only: # rcDataObjCreate is used instead of the irodsOpen wrapper so # that we can prevent overwriting doi = irods.dataObjInp_t() doi.objPath = rods_path doi.createMode = 0o640 doi.dataSize = 0 # 0 actually means "unknown", although literally 0 would be preferable irods.addKeyVal( doi.condInput, irods.DEST_RESC_NAME_KW, self.default_resource ) status = irods.rcDataObjCreate( self.rods_conn, doi ) assert status >= 0, 'create(): rcDataObjCreate() failed: %s: %s: %s' % ( rods_path, status, irods.strerror( status ) )