From c8d97de742ea54cb79b91f75d833b37d81be1e35 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Fri, 8 Nov 2024 11:34:00 +0100 Subject: [PATCH] fix NoneType context --- plone/app/z3cform/widgets/link.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plone/app/z3cform/widgets/link.py b/plone/app/z3cform/widgets/link.py index 10a97c50..6f9fbdf6 100644 --- a/plone/app/z3cform/widgets/link.py +++ b/plone/app/z3cform/widgets/link.py @@ -22,12 +22,13 @@ class LinkWidget(HTMLTextInputWidget, Widget): """ def pattern_data(self): + context = self.context or getSite() pattern_data = { "vocabularyUrl": "{}/@@getVocabulary?name=plone.app.vocabularies.Catalog".format( # noqa getSite().absolute_url(0), ), "rootPath": "/".join(getSite().getPhysicalPath()), - "basePath": "/".join(self.context.getPhysicalPath()), + "basePath": "/".join(context.getPhysicalPath()), "maximumSelectionSize": 1, } return json.dumps(pattern_data)