Skip to content

Commit 0b458c2

Browse files
authored
Fix Traceback for SENAITE Setup during installation (senaite#2064)
1 parent 3874f56 commit 0b458c2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/bika/lims/content/bikasetup.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -989,13 +989,17 @@ def getEmailBodySamplePublication(self):
989989
"""Get the value from the senaite setup
990990
"""
991991
setup = api.get_senaite_setup()
992-
return setup.getEmailBodySamplePublication()
992+
# setup is `None` during initial site content structure installation
993+
if setup:
994+
return setup.getEmailBodySamplePublication()
993995

994996
def setEmailBodySamplePublication(self, value):
995997
"""Set the value in the senaite setup
996998
"""
997999
setup = api.get_senaite_setup()
998-
setup.setEmailBodySamplePublication(value)
1000+
# setup is `None` during initial site content structure installation
1001+
if setup:
1002+
setup.setEmailBodySamplePublication(value)
9991003

10001004

10011005
registerType(BikaSetup, PROJECTNAME)

src/senaite/core/setuphandlers.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ def install(context):
172172
logger.info("SENAITE CORE install handler [BEGIN]")
173173
portal = context.getSite()
174174

175-
# Used in bika_setup, therefore it has to be added here
176-
add_senaite_setup(portal)
177-
178175
# Run required import steps
179176
_run_import_step(portal, "skins")
180177
_run_import_step(portal, "browserlayer")
@@ -200,6 +197,7 @@ def install(context):
200197
setup_catalog_mappings(portal)
201198
setup_auditlog_catalog_mappings(portal)
202199
setup_content_structure(portal)
200+
add_senaite_setup(portal)
203201
add_dexterity_portal_items(portal)
204202
add_dexterity_setup_items(portal)
205203

0 commit comments

Comments
 (0)