7

Renames personalisation module in documentation

This commit is contained in:
Jasper Berghoef
2017-05-30 15:46:27 +02:00
parent a73e356ffe
commit 83a7db5952
5 changed files with 13 additions and 13 deletions

View File

@ -12,7 +12,7 @@ Import and extend the ``personalisation.models.PersonalisablePage`` class to cre
A very simple example for a personalisable homepage:: A very simple example for a personalisable homepage::
from personalisation.models import PersonalisablePage from wagtail_personalisation.models import PersonalisablePage
class HomePage(PersonalisablePage): class HomePage(PersonalisablePage):
subtitle = models.CharField(max_length=255) subtitle = models.CharField(max_length=255)

View File

@ -35,7 +35,7 @@ class BaseSegmentsAdapter(object):
to a segment. to a segment.
:param rules: The rules to test for :param rules: The rules to test for
:type rules: list of personalisation.rules :type rules: list of wagtail_personalisation.rules
:param request: The http request :param request: The http request
:type request: django.http.HttpRequest :type request: django.http.HttpRequest
:param match_any: Whether all rules need to match, or any :param match_any: Whether all rules need to match, or any
@ -79,7 +79,7 @@ class SessionSegmentsAdapter(BaseSegmentsAdapter):
"""Return the segments stored in the request session. """Return the segments stored in the request session.
:returns: The segments in the request session :returns: The segments in the request session
:rtype: list of personalisation.models.Segment or empty list :rtype: list of wagtail_personalisation.models.Segment or empty list
""" """
return self.request.session['segments'] return self.request.session['segments']
@ -90,7 +90,7 @@ class SessionSegmentsAdapter(BaseSegmentsAdapter):
:param segment_id: The primary key of the segment :param segment_id: The primary key of the segment
:type segment_id: int :type segment_id: int
:returns: The matching segment :returns: The matching segment
:rtype: personalisation.models.Segment or None :rtype: wagtail_personalisation.models.Segment or None
""" """
return next(item for item in self.request.session['segments'] return next(item for item in self.request.session['segments']
@ -100,7 +100,7 @@ class SessionSegmentsAdapter(BaseSegmentsAdapter):
"""Add a segment to the request session. """Add a segment to the request session.
:param segment: The segment to add to the request session :param segment: The segment to add to the request session
:type segment: personalisation.models.Segment :type segment: wagtail_personalisation.models.Segment
""" """
@ -108,7 +108,7 @@ class SessionSegmentsAdapter(BaseSegmentsAdapter):
"""Check if the user has been segmented. """Check if the user has been segmented.
:param item: The segment to check for :param item: The segment to check for
:type item: personalisation.models.Segment :type item: wagtail_personalisation.models.Segment
:returns: Whether the segment is in the request session :returns: Whether the segment is in the request session
:rtype: bool :rtype: bool

View File

@ -10,7 +10,7 @@ class AdminPersonalisablePageForm(WagtailAdminPageForm):
"""Save a copy of the original page, linked to a segment. """Save a copy of the original page, linked to a segment.
:returns: The original page, or a new page. :returns: The original page, or a new page.
:rtype: personalisation.models.PersonalisablePage :rtype: wagtail_personalisation.models.PersonalisablePage
""" """
page = super(AdminPersonalisablePageForm, self).save(commit=False) page = super(AdminPersonalisablePageForm, self).save(commit=False)

View File

@ -6,9 +6,9 @@ def impersonate_other_page(page, other_page):
non-personalized path and page. non-personalized path and page.
:param page: The page to be impersonated :param page: The page to be impersonated
:type page: personalisation.models.PersonalisablePage :type page: wagtail_personalisation.models.PersonalisablePage
:param other_page: The page it should impersonate :param other_page: The page it should impersonate
:type other_page: personalisation.models.PersonalisablePage :type other_page: wagtail_personalisation.models.PersonalisablePage
""" """
page.path = other_page.path page.path = other_page.path
@ -21,7 +21,7 @@ def create_segment_dictionary(segment):
"""Creates a dictionary with all the required segment information. """Creates a dictionary with all the required segment information.
:param segment: Segment object :param segment: Segment object
:type segment: personalisation.models.Segment :type segment: wagtail_personalisation.models.Segment
:return: Dictionary with name, id, timestamp and persistent state. :return: Dictionary with name, id, timestamp and persistent state.
:rtype: dict :rtype: dict

View File

@ -131,12 +131,12 @@ def _check_for_variations(segments, page):
on the page being served. on the page being served.
:param segments: The segments applicable to the request. :param segments: The segments applicable to the request.
:type segments: list of personalisation.models.Segment :type segments: list of wagtail_personalisation.models.Segment
:param page: The page being served :param page: The page being served
:type page: personalisation.models.PersonalisablePage or :type page: wagtail_personalisation.models.PersonalisablePage or
wagtail.wagtailcore.models.Page wagtail.wagtailcore.models.Page
:returns: A variant of the requested page matching the segments or None :returns: A variant of the requested page matching the segments or None
:rtype: personalisation.models.PersonalisablePage or None :rtype: wagtail_personalisation.models.PersonalisablePage or None
""" """
for segment in segments: for segment in segments: