Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
plone.app.iterate.browser.checkout.Checkout Class Reference
Inheritance diagram for plone.app.iterate.browser.checkout.Checkout:
Inheritance graph
[legend]
Collaboration diagram for plone.app.iterate.browser.checkout.Checkout:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def containers
def __call__

Static Public Attributes

tuple template = ViewPageTemplateFile('checkout.pt')

Detailed Description

Definition at line 38 of file checkout.py.


Member Function Documentation

Definition at line 50 of file checkout.py.

00050 
00051     def __call__(self):
00052         context = aq_inner(self.context)
00053 
00054         containers = list(self.containers())
00055         if len(containers) == 1:
00056             # Special case for when there's only when folder to select
00057             self.request.form['form.button.Checkout'] = 1
00058             self.request.form['checkout_location'] = containers[0]['name']
00059 
00060         # We want to redirect to a specific template, else we might
00061         # end up downloading a file
00062         if self.request.form.has_key('form.button.Checkout'):
00063             control = getMultiAdapter((context, self.request), name=u"iterate_control")
00064             if not control.checkout_allowed():
00065                 raise CheckoutException(u"Not allowed")
00066 
00067             location = self.request.form.get('checkout_location', None)
00068             locator = None
00069             try:
00070                 locator = [c['locator'] for c in self.containers() if c['name'] == location][0]
00071             except IndexError:
00072                 IStatusMessage(self.request).addStatusMessage(_("Cannot find checkout location"), type='stop')
00073                 view_url = context.restrictedTraverse("@@plone_context_state").view_url()
00074                 self.request.response.redirect(view_url)
00075                 return
00076 
00077             policy = ICheckinCheckoutPolicy(context)
00078             wc = policy.checkout(locator())
00079             
00080             # we do this for metadata update side affects which will update lock info
00081             context.reindexObject('review_state')
00082             
00083             IStatusMessage(self.request).addStatusMessage(_("Check-out created"), type='info')
00084             view_url = wc.restrictedTraverse("@@plone_context_state").view_url()
00085             self.request.response.redirect(view_url)
00086         elif self.request.form.has_key('form.button.Cancel'):
00087             view_url = context.restrictedTraverse("@@plone_context_state").view_url()
00088             self.request.response.redirect(view_url)
00089         else:
00090             return self.template()

Here is the call graph for this function:

Here is the caller graph for this function:

Get a list of potential containers

Definition at line 42 of file checkout.py.

00042 
00043     def containers(self):
00044         """Get a list of potential containers
00045         """
00046         context = aq_inner(self.context)
00047         for name, locator in getAdapters((context,), IWCContainerLocator):
00048             if locator.available:
00049                 yield dict(name=name, locator=locator)
    

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple plone.app.iterate.browser.checkout.Checkout.template = ViewPageTemplateFile('checkout.pt') [static]

Definition at line 40 of file checkout.py.


The documentation for this class was generated from the following file: