#NEWLINE# def new( self , event , collection = None ) : #NEWLINE# #INDENT# 'save a new event to the vdir and the database\n\n        param event: the event that should be updated\n        type event: event.Event\n        ' #NEWLINE# calendar = ( collection if ( collection is not None ) else event . calendar ) #NEWLINE# if hasattr ( event , 'etag' ) : #NEWLINE# #INDENT# assert ( not event . etag ) #NEWLINE# #UNINDENT# if self . _calendars [ calendar ] [ 'readonly' ] : #NEWLINE# #INDENT# raise ReadOnlyCalendarError ( ) #NEWLINE# #UNINDENT# with self . _backend . at_once ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( href , etag ) = self . _storages [ calendar ] . upload ( event ) #NEWLINE# #UNINDENT# except AlreadyExistingError as Error : #NEWLINE# #INDENT# href = getattr ( Error , 'existing_href' , None ) #NEWLINE# raise DuplicateUid ( href ) #NEWLINE# #UNINDENT# self . _backend . update ( event . raw , href , etag , calendar = calendar ) #NEWLINE# self . _backend . set_ctag ( self . _local_ctag ( calendar ) , calendar = calendar )