Module: add convenience method to set the version for a module in the database
This commit is contained in:
		
							parent
							
								
									14f2a027fe
								
							
						
					
					
						commit
						a61fb37394
					
				
							
								
								
									
										12
									
								
								Module.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Module.py
									
									
									
									
									
								
							| @ -215,6 +215,18 @@ class Module(object): | ||||
| 
 | ||||
|         return version | ||||
| 
 | ||||
|     def db_register_module_version(self, modulename, version): | ||||
|         """Enter the given module name and version number into the database.""" | ||||
| 
 | ||||
|         db = self.get_db() | ||||
|         try: | ||||
|             db.execute('UPDATE drbotzo_modules SET version = ? WHERE module = ?', (version, modulename)) | ||||
|             db.commit() | ||||
|         except sqlite3.Error as e: | ||||
|             db.rollback() | ||||
|             print("sqlite error: " + str(e)) | ||||
|             raise | ||||
| 
 | ||||
|     def db_init(self): | ||||
|         """ | ||||
|         Set up the database tables and so on, if subclass is planning on using it. | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user