ploneintranet.network.browser package¶
Submodules¶
ploneintranet.network.browser.interfaces module¶
-
interface
ploneintranet.network.browser.interfaces.
IAuthorProvider
¶ Bases:
zope.contentprovider.interfaces.IContentProvider
Marker interface to define author helpers
-
show_subunsub
= <zope.interface.interface.Attribute object>¶ Whether to show sub/unsub buttons?
-
is_mine
= <zope.interface.interface.Attribute object>¶ Is this the author view of the viewer_id?
-
is_anonymous
= <zope.interface.interface.Attribute object>¶ Is the viewer anon?
-
request
= <zope.interface.interface.Attribute object>¶ The request object driving the view
-
userid
= <zope.interface.interface.Attribute object>¶ The guy in the author view
-
update
()¶ Initialize the content provider.
This method should perform all state calculation and not refer it to the rendering stage.
In this method, all state must be calculated from the current interaction (e.g., the browser request); all contained or managed content providers must have
update()
be called as well; any additional stateful API for contained or managed content providers must be handled; and persistent objects should be modified, if the provider is going to do it.Do not store state about persistent objects: the rendering process should actually use the persistent objects for the data, in case other components modify the object between the update and render stages.
This method must be called before any other method that mutates the instance (besides the class constructor). Non-mutating methods and attributes may raise an error if used before
update()
is called. The view may rely on this order but is not required to explicitly enforce this. Implementations may enforce it as a developer aid.
-
viewer_id
= <zope.interface.interface.Attribute object>¶ The guy looking at the author
-
render
(*args, **kw)¶ Return the content provided by this content provider.
Calling this method before
update()
may (but is not required to) raise anUpdateNotCalled
error.
-
is_following
= <zope.interface.interface.Attribute object>¶ Is viewer_id following user_id?
-
context
= <zope.interface.interface.Attribute object>¶ The context object the view renders
-
portrait
= <zope.interface.interface.Attribute object>¶ Portrait of userid
-
data
= <zope.interface.interface.Attribute object>¶ User data on userid
-
-
interface
ploneintranet.network.browser.interfaces.
IPloneIntranetNetworkLayer
¶ Bases:
zope.interface.Interface
Marker interface to define ZTK browser layer
ploneintranet.network.browser.likes module¶
-
exception
ploneintranet.network.browser.likes.
NotAllowed
¶ Bases:
exceptions.Exception
-
class
ploneintranet.network.browser.likes.
ToggleLike
(context, request)¶ Bases:
Products.Five.browser.BrowserView
The view ‘toggle_like’ callable on a normal context.
-
action
()¶
-
handle_toggle
()¶ Perform the actual like/unlike action. Since this does a db write it cannot be called with a GET.
-
index
= <BoundPageTemplateFile of None>¶
-
likerids
¶ Wrapper to avoid memoization in subclass where that is invalid.
-
likers
¶ Wrapper to avoid memoization in subclass where that is invalid.
-
total_likes
()¶
-
unmemoized_likerids
¶ The id of the people that like this content
-
unmemoized_likers
¶ The id of the people that like this content
If it includes the current user, return Myself as the first element
-
validate_id
(item_id)¶ Check if item_id is a valid UUID
-
-
class
ploneintranet.network.browser.likes.
ToggleLikeStatusUpdate
(context, request)¶ Bases:
ploneintranet.network.browser.likes.ToggleLike
The special view ‘toggle_like’ callable on the navroot.
This works around the limitation that you cannot traverse to a StatusUpdate. Instead of calling statusupdate/@@like we call portal/@@like/statusid
It uses publishTraverse to allow passing the id of an object as a path: /@@toggle_like/1453656
Note that one cannot use normal memoization on methods on this view: it’s context is always the navroot, so it will memoize improperly across statusupdates.
-
action
()¶
-
index
= <BoundPageTemplateFile of None>¶
-
likerids
¶
-
likers
¶
-
publishTraverse
(request, name)¶ Extract self.item_id from URL /@@toggle_like/123456
-
validate_id
(item_id)¶ Check if the item_id is the id of a StatusUpdate
-