The permalink would be initialized into the context by:

  • pylucid_project.apps.pylucid.context_processors.pylucid

It used the permalink created by the current pagemeta.
To change the permalink, e.g. for a deeplink to a item detail, use this pattern:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# plugin models.py
...
from pylucid_project.apps.pylucid.system.permalink import plugin_permalink

class MyItemModel(models.Model):
    ...
    def get_absolute_url(self):
        url_title = slugify(self.headline)
        viewname = "Blog-detail_view"
        reverse_kwargs = {"id": self.pk, "title":url_title}
        try:
            # This only worked inner lucidTag
            return urlresolvers.reverse(viewname, kwargs=reverse_kwargs)
        except urlresolvers.NoReverseMatch:
            # Use the first PluginPage instance
            try:
                return PluginPage.objects.reverse("blog", viewname, kwargs=reverse_kwargs)
            except urlresolvers.NoReverseMatch:
                return "#No-Blog-PagePlugin-exists"

    def get_permalink(self, request):
        """ permalink to this item detail view """
        absolute_url = self.get_absolute_url() # Absolute url to this item
        permalink = plugin_permalink(request, absolute_url)
        return permalink

# plugin view.py
...
@render_to("foo/bar.html")
def detail_view(request, slug):
    ... # get the current model item to display in a detail view

    _add_breadcrumb(request, title="%s: %s" % (item.term, item.short_definition), url=request.path)

    # Change permalink from the blog root page to this item detail view
    permalink = item.get_permalink(request)
    request.PYLUCID.context["page_permalink"] = permalink # for e.g. the HeadlineAnchor

    context = {
        "item": item,
        "page_permalink": permalink, # Change the permalink in the global page template
    }
    return context

The blog and lexicon plugin does this, yet.