Greg Turner
unread,Oct 5, 2010, 3:55:22 AM10/5/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to glamkit-developers
Hi,
In GLAMkit, there are a few different ways of marking and managing
content which is to be embargoed, and various other approaches in our
projects. I think we should standardise on a single approach that
handles the majority of cases in our projects.
1) Blogtools' StatusableEntryMixin, that provides live/draft/hidden
statuses, and provides a basic manager with methods to get live and
live_and_draft items.
Problems with this approach:
* It's siloed in blogtools, even though the functionality it provides
is not specially related to blog entries. It should probably be in
glamkit-core or a new place like glamkit-publishtools.
* Requires remembering to call the correct manager method (e.g.
Entry.objects.live_and_draft().filter....) at the beginning of every
query. Omitting this is the source of many bugs in code we create, and
is incompatible with 3rd-party code that performs queries on models.
It should be possible to have this functionality from 'objects' if
desired.
* Doesn't have an equivalent queryset manager
* Slightly arbitrary "Hidden" status.
2) incubated's TimedPublishingMixin, which takes publish status from a
settings file, and uses a SERVER_STATUS setting to indicate which
queryset to return.
Problems with this approach:
* Enforces both status AND timed publishing, when any combination
might be required.
* SERVER_STATUS is a strange name.
* Defines 'objects', where we should leave that to the user. Further,
other glamkit mixins also define 'objects'.
* Not documented.
Proposal
------------
I think we should deprecate both, and create a new app based on
timedpublishing, called glamkit-publishtools. It:
* Defines various mixins, primarily: Publishable (abstract),
PublishStatusable, PublishEmbargoable, PublishExpirable (and any of 4
trivial subclasses that combine the last 3).
* PublishStatusable defines a publish_status field, and reads from a
setting that outlines the status choices.
* PublishEmbargoable and PublishExpirable define publish_from and
publish_to fields respectively.
* The combination subclasses read from settings that allow
publish_from/to to be affected
Each mixin defines an 'is_live' method, which returns True if the item
is set to be visible to the public.
Each mixin has a corresponding manager, which gets the default
queryset of live items.
These can be overridden with a "OVERRIDE_PUBLISH_STATUS" setting,
which treats all content in the default queryset as having a
particular publish status, for the purposes of preview on staging,
etc. We can assume this setting is omitted on production sites.
However, if, even on staging, you want to check the true value (eg.
for showing a 'DRAFT' background on the content), then there is a
method on each called is_really_live().
I'm willing to build this, once consensus is reached. Any thoughts/
modifications?
Greg.