#NEWLINE# @ receiver ( pre_save , sender = Database ) #NEWLINE# def database_pre_save( sender , **kwargs ) : #NEWLINE# #INDENT# database = kwargs . get ( 'instance' ) #NEWLINE# if database . is_in_quarantine : #NEWLINE# #INDENT# if ( database . quarantine_dt is None ) : #NEWLINE# #INDENT# database . quarantine_dt = datetime . datetime . now ( ) . date ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# database . quarantine_dt = None #NEWLINE# #UNINDENT# if database . id : #NEWLINE# #INDENT# saved_object = Database . objects . get ( id = database . id ) #NEWLINE# if ( database . name != database . name ) : #NEWLINE# #INDENT# raise AttributeError ( _ ( 'Attribute name cannot be edited' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if database_name_evironment_constraint ( database . name , database . environment . name ) : #NEWLINE# #INDENT# raise AttributeError ( ( _ ( '%s already exists in production!' ) % database . name ) ) #NEWLINE# #UNINDENT# LOG . debug ( ( "slugfying database's name for %s" % database . name ) ) #NEWLINE# database . name = slugify ( database . name )