-
Notifications
You must be signed in to change notification settings - Fork 25
feat: simpler component configuration #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0160a9d
d69b761
1449947
cf4c4ef
b3a6876
bbbf003
d1bf9ad
05a8341
a459a06
9372e7b
a7e5e6f
a65a860
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from cms.plugin_pool import plugin_pool | ||
from django.core.exceptions import ImproperlyConfigured | ||
|
||
from .ui_plugin_base import CMSUIPluginBase | ||
|
||
|
@@ -11,7 +12,7 @@ def update_plugin_pool(): | |
from .component_pool import components | ||
|
||
# Loop through the values in the components' registry | ||
for _, plugin, slot_plugins in components._registry.values(): | ||
for key, (_, plugin, slot_plugins) in components._registry.items(): | ||
if plugin.__name__ not in plugin_pool.plugins: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (code-quality): We've found these issues:
|
||
# Add the plugin to the global namespace | ||
globals()[plugin.__name__] = plugin | ||
|
@@ -24,3 +25,8 @@ def update_plugin_pool(): | |
globals()[slot_plugin.__name__] = slot_plugin | ||
# Register the slot plugin with the plugin pool | ||
plugin_pool.register_plugin(slot_plugin) | ||
fsbraun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else: | ||
raise ImproperlyConfigured( | ||
f"Cannot register frontend component {key} since a plugin {plugin.__name__} " | ||
f"is already registered by {plugin_pool.plugins[plugin.__name__].__module__}." | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -174,7 +174,7 @@ def plugin_factory(cls) -> type: | |||||
if hasattr(cls, "get_render_template") | ||||||
else {} | ||||||
), | ||||||
"__module__": cls.__module__, | ||||||
"__module__": "djangocms_frontend.cms_plugins", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Hardcoding module may affect debugging and serialization Overriding module can break stack traces, pickling, and introspection. Either keep the original module or use qualname to group classes.
Suggested change
|
||||||
}, | ||||||
) | ||||||
return cls._plugin | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.