Use sql.row_factory = sqlite3.Row.
This commit is contained in:
		
							parent
							
								
									01a4864762
								
							
						
					
					
						commit
						c63f63f6a7
					
				
					 2 changed files with 2 additions and 5 deletions
				
			
		|  | @ -262,7 +262,6 @@ class Album(ObjectBase, GroupableMixin): | |||
| 
 | ||||
|     def __init__(self, photodb, db_row): | ||||
|         super().__init__(photodb) | ||||
|         db_row = self.photodb.normalize_db_row(db_row, self.table) | ||||
| 
 | ||||
|         self.id = db_row['id'] | ||||
|         self.title = self.normalize_title(db_row['title']) | ||||
|  | @ -699,7 +698,6 @@ class Bookmark(ObjectBase): | |||
| 
 | ||||
|     def __init__(self, photodb, db_row): | ||||
|         super().__init__(photodb) | ||||
|         db_row = self.photodb.normalize_db_row(db_row, self.table) | ||||
| 
 | ||||
|         self.id = db_row['id'] | ||||
|         self.title = self.normalize_title(db_row['title']) | ||||
|  | @ -809,7 +807,6 @@ class Photo(ObjectBase): | |||
| 
 | ||||
|     def __init__(self, photodb, db_row): | ||||
|         super().__init__(photodb) | ||||
|         db_row = self.photodb.normalize_db_row(db_row, self.table) | ||||
| 
 | ||||
|         self.real_path = db_row['filepath'] | ||||
|         self.real_path = pathclass.Path(self.real_path) | ||||
|  | @ -1447,7 +1444,6 @@ class Tag(ObjectBase, GroupableMixin): | |||
| 
 | ||||
|     def __init__(self, photodb, db_row): | ||||
|         super().__init__(photodb) | ||||
|         db_row = self.photodb.normalize_db_row(db_row, self.table) | ||||
| 
 | ||||
|         self.id = db_row['id'] | ||||
|         # Do not pass the name through the normalizer. It may be grandfathered | ||||
|  | @ -1823,7 +1819,6 @@ class User(ObjectBase): | |||
| 
 | ||||
|     def __init__(self, photodb, db_row): | ||||
|         super().__init__(photodb) | ||||
|         db_row = self.photodb.normalize_db_row(db_row, self.table) | ||||
| 
 | ||||
|         self.id = db_row['id'] | ||||
|         self.username = db_row['username'] | ||||
|  |  | |||
|  | @ -1601,6 +1601,7 @@ class PhotoDB( | |||
|         if self.ephemeral: | ||||
|             existing_database = False | ||||
|             self.sql = sqlite3.connect(':memory:') | ||||
|             self.sql.row_factory = sqlite3.Row | ||||
|             self._first_time_setup() | ||||
|             return | ||||
| 
 | ||||
|  | @ -1614,6 +1615,7 @@ class PhotoDB( | |||
|         self.data_directory.makedirs(exist_ok=True) | ||||
|         log.debug('Connecting to sqlite file "%s".', self.database_filepath.absolute_path) | ||||
|         self.sql = sqlite3.connect(self.database_filepath.absolute_path) | ||||
|         self.sql.row_factory = sqlite3.Row | ||||
| 
 | ||||
|         if existing_database: | ||||
|             if not skip_version_check: | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue