Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*The data model module for the `transients_element_history_delete` resource*
6:Author:
7 David Young
8"""
9from builtins import object
10import sys
11import os
12import khufu
14class models_transients_element_history_delete(object):
15 """
16 The worker class for the models_transients_element_history_delete module
18 **Key Arguments**
20 - ``log`` -- logger
21 - ``request`` -- the pyramid request
22 - ``elementId`` -- the specific element id requests (or False)
23 - ``search`` -- is this a search request (boolean)
25 """
27 def __init__(
28 self,
29 log,
30 request,
31 elementId=False,
32 search=False
33 ):
34 self.log = log
35 self.request = request
36 self.elementId = elementId
37 self.search = search
38 self.qs = dict(request.params) # the query string
39 # THE QUERY STRING DEFAULTS
40 self.defaultQs = {}
41 # xt-self-arg-tmpx
43 log.debug(
44 "instansiating a new 'models_transients_element_history_delete' object")
46 self._set_default_parameters()
48 return None
50 def close(self):
51 del self
52 return None
54 def delete(self):
55 """execute the delete method on the models_transients_element_history_delete object
57 **Return**
59 - ``responseContent`` -- the reponse to send to the browser
61 """
62 self.log.debug('starting the ``delete`` method')
64 elementId = self.elementId
66 responseContent = "Response from <code>" + __name__ + "</code><BR><BR>"
67 if elementId:
68 responseContent = "%(responseContent)sThe element selected was </code>%(elementId)s</code>" % locals(
69 )
70 else:
71 responseContent = "%(responseContent)sResource Context selected (no element)" % locals(
72 )
74 self.log.debug('completed the ``delete`` method')
75 return responseContent
77 def _set_default_parameters(
78 self):
79 """ set default parameters
80 """
81 self.log.debug('starting the ``_set_default_parameters`` method')
83 for k, v in list(self.defaultQs.items()):
84 if k not in self.qs:
85 self.qs[k] = v
87 self.log.debug('completed the ``_set_default_parameters`` method')
88 return None
90 # method-override-tmpx