mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00

This greatly reduced the amount of duplicate code in the DataBaseHandlers Not sure how secure this is SQL injections. Need to check that and maybe put in some guards. Using double underscores for now and only provide a getter. But then again why bother with an SQL injection as you can just as easily modify the Python code, and we still have the old Containers to fallback to if the Database gets corrupted. Contributes to CURA-6096
22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
from UM.Settings.SQLQueryFactory import SQLQueryFactory
|
|
from UM.Settings.DatabaseContainerMetadataController import DatabaseMetadataContainerController
|
|
from UM.Settings.InstanceContainer import InstanceContainer
|
|
|
|
|
|
class IntentDatabaseHandler(DatabaseMetadataContainerController):
|
|
"""The Database handler for Intent containers"""
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__(SQLQueryFactory(table = "intents",
|
|
fields = {
|
|
"id": "text",
|
|
"name": "text",
|
|
"quality_type": "text",
|
|
"intent_category": "text",
|
|
"variant": "text",
|
|
"definition": "text",
|
|
"material": "text",
|
|
"version": "text",
|
|
"setting_version": "text"
|
|
}))
|
|
self.container_type = InstanceContainer
|