checkmate5 4.1.0.dev40__py3-none-any.whl → 4.1.0.dev42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,14 +106,30 @@ def get_project(project_path, project_config, settings, backend):
106
106
  project_class = project_config.get('project_class', 'Project')
107
107
  ProjectClass = settings.models[project_class]
108
108
 
109
- # Attempt to find the project by project_id
110
- project = backend.get(ProjectClass, {'pk': project_config['project_id']})
109
+ try:
110
+ # Try to get the project using its primary key
111
+ project = backend.get(ProjectClass, {'pk': project_config['project_id']})
112
+
113
+
114
+ except ProjectClass.DoesNotExist:
115
+ # If the project doesn't exist, create a new one
116
+ # Create a new instance of ProjectClass.
117
+ # It's good practice to set the 'pk' explicitly if it's derived from your config,
118
+ # otherwise BlitzDB will generate one. Here, we're using project_id as pk.
119
+ project = ProjectClass(project_config)
120
+ project.pk = project_config['project_id'] # Ensure the PK is set to your project_id
121
+
122
+ # Save the newly created project
123
+ backend.save(project)
111
124
 
112
- # If the project doesn't exist, create a new one
113
- if project is None:
114
- project = ProjectClass(pk=project_config['project_id'])
115
- backend.add(project)
116
125
  # If needed, ensure that the project is persisted
117
- backend.commit() # If your backend requires an explicit commit
126
+ # (Crucial for FileBackend, optional/less critical for MongoBackend as it auto-persists)
127
+ backend.commit()
128
+
129
+ except ProjectClass.MultipleDocumentsReturned:
130
+ # This case should ideally not happen if 'pk' is truly unique.
131
+ # It means you have multiple documents with the same generated PK (a severe data integrity issue)
132
+ # or you're querying on non-unique fields with get().
133
+ raise # Re-raise the exception or handle appropriately
118
134
 
119
135
  return project
@@ -95,7 +95,7 @@ def main():
95
95
 
96
96
  CommandClass, command_chain = load_command_class(settings)
97
97
 
98
- if CommandClass.requires_valid_project and project is None:
98
+ if project is None:
99
99
  sys.stderr.write(
100
100
  "Cannot find a checkmate project in the current directory tree, aborting.\n")
101
101
  exit(-1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: checkmate5
3
- Version: 4.1.0.dev40
3
+ Version: 4.1.0.dev42
4
4
  Summary: A meta-code checker written in Python.
5
5
  Author: Andreas Dewes
6
6
  License: AGPL-3.0
@@ -12,6 +12,7 @@ License-File: LICENSE.txt
12
12
  Requires-Dist: blitzdb5
13
13
  Requires-Dist: pyyaml
14
14
  Requires-Dist: sqlalchemy
15
+ Requires-Dist: requests
15
16
  Dynamic: license-file
16
17
 
17
18
  # Welcome to Checkmate!
@@ -83,7 +83,7 @@ checkmate/lib/stats/helpers.py,sha256=X21Pb7dz3PWubDRoqUjbxwonl43TRxqKEcwyM80tS6
83
83
  checkmate/lib/stats/mapreduce.py,sha256=rGdA_HninEZSeowtBn5R02c6wyT5dxcu-0T2ftlMnY0,782
84
84
  checkmate/management/__init__.py,sha256=iwhKnzeBJLKxpRVjvzwiRE63_zNpIBfaKLITauVph-0,24
85
85
  checkmate/management/decorators.py,sha256=iwhKnzeBJLKxpRVjvzwiRE63_zNpIBfaKLITauVph-0,24
86
- checkmate/management/helpers.py,sha256=hMAdTC3JAALvzNWl_cFjwlQ-09cjg12wNT29vbddIfU,4621
86
+ checkmate/management/helpers.py,sha256=Yy99f_IpHdpd08XFZ17ydzcAToutUh-WJKpQwo5ar0k,5413
87
87
  checkmate/management/commands/__init__.py,sha256=XAi0y8z1NviyGvLB68Oxnzr6Nw5AP8xgbcSSnc1Zcvw,766
88
88
  checkmate/management/commands/alembic.py,sha256=DTWH8hcY6UmWDo0wMwcID_wQIa-es7nyJHV6p1_T4FQ,718
89
89
  checkmate/management/commands/analyze.py,sha256=J1rawVEGjbrXT9ArfUVpfoLNs2JaFkV4mCrBnEIrXaw,1159
@@ -107,13 +107,13 @@ checkmate/management/commands/props/delete.py,sha256=skrsBtAz-w_4_ZpX88AADWBGcmg
107
107
  checkmate/management/commands/props/get.py,sha256=YsvE_sr8ViIvpjLJ7sPMp6UoujKGWMrcaZMnAVfQnNs,763
108
108
  checkmate/management/commands/props/set.py,sha256=VEoFbHletPqZXeHdiqXOGbgLArf4FHBZNupNH4DaRIo,728
109
109
  checkmate/scripts/__init__.py,sha256=XAi0y8z1NviyGvLB68Oxnzr6Nw5AP8xgbcSSnc1Zcvw,766
110
- checkmate/scripts/manage.py,sha256=mpioBaxzirAKXZtbxO-y4dbOcc6UoP0MaAMsNuKHbz0,4253
110
+ checkmate/scripts/manage.py,sha256=Ci0HBkvB_KzGIQTAr1UnwEXWuqDq7MP2e7Y_7p2CC94,4213
111
111
  checkmate/settings/__init__.py,sha256=z32hPz-kGS-tTGa6dWCFjrrrbS_eagLd-YrqBP3gjWI,33
112
112
  checkmate/settings/base.py,sha256=3WBXZITqoWepIja96bo5JTi-TDpQALPTCugL0E8z-yE,4551
113
113
  checkmate/settings/defaults.py,sha256=JaR9H5fciWy4PMX3oqIeaui7HDzjWSIhsXZD3tj4mSc,2736
114
- checkmate5-4.1.0.dev40.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
115
- checkmate5-4.1.0.dev40.dist-info/METADATA,sha256=R1Qoj7bziHazH38CC5ARQ_XJgfMwpy0kxALFM0Ls3HQ,1262
116
- checkmate5-4.1.0.dev40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
117
- checkmate5-4.1.0.dev40.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
118
- checkmate5-4.1.0.dev40.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
119
- checkmate5-4.1.0.dev40.dist-info/RECORD,,
114
+ checkmate5-4.1.0.dev42.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
115
+ checkmate5-4.1.0.dev42.dist-info/METADATA,sha256=znr31OI8-Tw2pKYmCG6VkEXCP6mazp7AuCPwQ3fOIh4,1286
116
+ checkmate5-4.1.0.dev42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
117
+ checkmate5-4.1.0.dev42.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
118
+ checkmate5-4.1.0.dev42.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
119
+ checkmate5-4.1.0.dev42.dist-info/RECORD,,