handle renaming in pre_save
I chose pre_save so that if renaming fails, the db and disk remain consistent.
This commit is contained in:
		
							parent
							
								
									f7bbdf3f0f
								
							
						
					
					
						commit
						0a5dae85a3
					
				| @ -200,11 +200,16 @@ def on_townie_pre_save(sender, instance, **kwargs): | ||||
| 
 | ||||
|     existing = existing[0] | ||||
| 
 | ||||
|     if not existing.reviewed and instance.reviewed == True: | ||||
|     # See if we need to create this user on disk. | ||||
|     if not existing.reviewed and instance.reviewed is True: | ||||
|         instance.create_on_disk() | ||||
|         instance.send_welcome_email() | ||||
|         instance.write_authorized_keys() | ||||
| 
 | ||||
|     # See if this user needs a rename on disk | ||||
|     if existing.username != instance.username: | ||||
|         instance.rename_on_disk(existing.username) | ||||
| 
 | ||||
| 
 | ||||
| def _guarded_run(cmd_args, **run_args): | ||||
|     """Given a list of args representing a command invocation as well as var | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user