Skip to content

Commit

Permalink
ci: more deprecations in light of upcoming v4 (#7480)
Browse files Browse the repository at this point in the history
* Add deprecation warnings to cms.api

* Fix typos

---------

Co-authored-by: Vinit Kumar <vinit.kumar@kidskonnect.nl>
  • Loading branch information
fsbraun and vinitkumar committed Apr 10, 2023
1 parent 89a42dd commit 4c0b3a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion cms/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
calling these methods!
"""
import datetime
import warnings

from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
Expand Down Expand Up @@ -412,6 +413,10 @@ def publish_page(page, user, language):
See docs/extending_cms/api_reference.rst for more info
"""
warnings.warn('This API function will be removed in django CMS 4. For publishing functionality use a package '
'that adds publishing, such as: djangocms-versioning.',
UserWarning, stacklevel=2)

page = page.reload()

if not page.has_publish_permission(user):
Expand All @@ -428,6 +433,10 @@ def publish_pages(include_unpublished=False, language=None, site=None):
"""
Create published public version of selected drafts.
"""
warnings.warn('This API function will be removed in django CMS 4. For publishing functionality use a package '
'that adds publishing, such as: djangocms-versioning.',
UserWarning, stacklevel=2)

qs = Page.objects.drafts()

if not include_unpublished:
Expand Down Expand Up @@ -463,6 +472,10 @@ def get_page_draft(page):
:return page: draft version of the page
:type page: :class:`cms.models.pagemodel.Page` instance
"""
warnings.warn('This API function will be removed in django CMS 4. For publishing functionality use a package '
'that adds publishing, such as: djangocms-versioning.',
UserWarning, stacklevel=2)

if page:
if page.publisher_is_draft:
return page
Expand All @@ -478,7 +491,7 @@ def copy_plugins_to_language(page, source_language, target_language,
Copy the plugins to another language in the same page for all the page
placeholders.
By default plugins are copied only if placeholder has no plugin for the
By default, plugins are copied only if placeholder has no plugin for the
target language; use ``only_empty=False`` to change this.
.. warning: This function skips permissions checks
Expand Down
6 changes: 3 additions & 3 deletions cms/plugin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def __init__(self, model=None, admin_site=None):
self.cms_plugin_instance = None
# The _cms_initial_attributes acts as a hook to set
# certain values when the form is saved.
# Currently this only happens on plugin creation.
# Currently, this only happens on plugin creation.
self._cms_initial_attributes = {}
self._operation_token = None

Expand Down Expand Up @@ -259,7 +259,7 @@ def render_close_frame(self, request, obj, extra_context=None):
# This is a nasty edge-case.
# If the parent plugin is a ghost plugin, fetching the plugin tree
# will fail because the downcasting function filters out all ghost plugins.
# Currently this case is only present in the djangocms-text-ckeditor app
# Currently, this case is only present in the djangocms-text-ckeditor app
# which uses ghost plugins to create inline plugins on the text.
root = obj

Expand Down Expand Up @@ -432,7 +432,7 @@ def get_child_plugin_candidates(cls, slot, page):
# we allow other plugins to affect
# the list of child plugin candidates.
# Useful in cases like djangocms-text-ckeditor
# where only text only plugins are allowed.
# where only text-enabled plugins are allowed.
from cms.plugin_pool import plugin_pool
return plugin_pool.registered_plugins

Expand Down

0 comments on commit 4c0b3a8

Please sign in to comment.