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/bin/env python
2# encoding: utf-8
3"""
4*The data model module for the `transients_comments_element_post` resource*
6:Author:
7 David Young
8"""
9from builtins import object
10import sys
11import os
12import khufu
14class models_transients_comments_element_post(object):
15 """
16 *The worker class for the models_transients_comments_element_post 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)
26 **Usage**
30 ```eval_rst
31 .. todo::
33 - add usage info
34 - create a sublime snippet for usage
35 - add a tutorial about ``models_transients_comments_element_post`` to documentation
36 - create a blog post about what ``models_transients_comments_element_post`` doess
37 ```
39 ```python
40 usage code
41 ```
42 """
43 # Initialisation
45 def __init__(
46 self,
47 log,
48 request,
49 elementId=False,
50 search=False
51 ):
52 self.log = log
53 self.request = request
54 self.elementId = elementId
55 self.search = search
56 self.qs = dict(request.params) # the query string
57 # the query string defaults
58 self.defaultQs = {}
59 # xt-self-arg-tmpx
61 log.debug(
62 "instansiating a new 'models_transients_comments_element_post' object")
64 # Variable Data Atrributes
66 # Initial Actions
67 self._set_default_parameters()
69 return None
71 # Method Attributes
72 def post(self):
73 """
74 *execute the post method on the models_transients_comments_element_post object*
76 **Return**
78 - ``responseContent`` -- the reponse to send to the browser
80 """
81 self.log.debug('starting the ``post`` method')
83 elementId = self.elementId
85 responseContent = "Response from <code>" + __name__ + "</code><BR><BR>"
86 if elementId:
87 responseContent = "%(responseContent)sThe element selected was </code>%(elementId)s</code>" % locals(
88 )
89 else:
90 responseContent = "%(responseContent)sResource Context selected (no element)" % locals(
91 )
93 self.log.debug('completed the ``post`` method')
94 return responseContent
96 def _set_default_parameters(
97 self):
98 """
99 *set default parameters*
101 **Key Arguments**
103 -
106 **Return**
108 - None
110 """
111 self.log.debug('starting the ``_set_default_parameters`` method')
113 for k, v in list(self.defaultQs.items()):
114 if k not in self.qs:
115 self.qs[k] = v
117 self.log.debug('completed the ``_set_default_parameters`` method')
118 return None
120 # xt-class-method