Skip to content

Commit

Permalink
Fix default DOI when adding content
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Jan 23, 2024
1 parent 6461364 commit ed5843d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/recensio/plone/behaviors/base_review.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from plone.autoform import directives
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.dexterity.utils import iterSchemata
from plone.namedfile.field import NamedBlobFile
from plone.namedfile.field import NamedBlobImage
from plone.registry.interfaces import IRegistry
Expand All @@ -26,6 +27,9 @@ def generateDoi(context):
Might not need to be called as a default factory, but just in the
edit form
"""
if IBaseReview not in iterSchemata(context):
# XXX When adding new content we get the container as context
return None
registry = getUtility(IRegistry)
settings = registry.forInterface(
IRecensioSettings, prefix="recensio.plone.settings"
Expand Down

0 comments on commit ed5843d

Please sign in to comment.