equal
deleted
inserted
replaced
12 # distributed under the License is distributed on an "AS IS" BASIS, |
12 # distributed under the License is distributed on an "AS IS" BASIS, |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 # See the License for the specific language governing permissions and |
14 # See the License for the specific language governing permissions and |
15 # limitations under the License. |
15 # limitations under the License. |
16 |
16 |
17 """Params related methods |
17 """Params related methods. |
18 """ |
18 """ |
19 |
19 |
20 __authors__ = [ |
20 __authors__ = [ |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>', |
22 ] |
22 ] |
44 def constructParams(params): |
44 def constructParams(params): |
45 """Constructs a new params dictionary based on params |
45 """Constructs a new params dictionary based on params |
46 |
46 |
47 Params usage: |
47 Params usage: |
48 The params dictionary is passed to getCreateForm and getEditForm, |
48 The params dictionary is passed to getCreateForm and getEditForm, |
49 see their docstring on how they use it. |
49 see their docstring on how they use it. |
50 |
50 |
51 rights: The rights value is merged with a default rights |
51 rights: The rights value is merged with a default rights |
52 dictionary and then used as rights value. |
52 dictionary and then used as rights value. |
53 url_name: The url_name value is used in constructing several |
53 url_name: The url_name value is used in constructing several |
54 redirects as the first part of the url. |
54 redirects as the first part of the url. |
177 params['key_fields_pattern'] = getKeyFieldsPattern(params) |
177 params['key_fields_pattern'] = getKeyFieldsPattern(params) |
178 |
178 |
179 return params |
179 return params |
180 |
180 |
181 def getCreateForm(params): |
181 def getCreateForm(params): |
182 """Constructs a new CreateForm using params |
182 """Constructs a new CreateForm using params. |
183 |
183 |
184 Params usage: |
184 Params usage: |
185 dynabase: The dynabase value is used as the base argument to |
185 dynabase: The dynabase value is used as the base argument to |
186 dynaform.newDynaForm. |
186 dynaform.newDynaForm. |
187 logic: The logic value is used to get the model argument to newDynaForm. |
187 logic: The logic value is used to get the model argument to newDynaForm. |
199 ) |
199 ) |
200 |
200 |
201 return create_form |
201 return create_form |
202 |
202 |
203 def getEditForm(params): |
203 def getEditForm(params): |
204 """Constructs a new EditForm using params |
204 """Constructs a new EditForm using params. |
205 |
205 |
206 Params usage: |
206 Params usage: |
207 create_form: The dynabase value is used as the dynaform argument |
207 create_form: The dynabase value is used as the dynaform argument |
208 to dyanform.extendDynaForm. |
208 to dyanform.extendDynaForm. |
209 edit_dynainclude: same as create_form, but as dynainclude argument |
209 edit_dynainclude: same as create_form, but as dynainclude argument |
219 ) |
219 ) |
220 |
220 |
221 return edit_form |
221 return edit_form |
222 |
222 |
223 def getKeyFieldsPattern(params): |
223 def getKeyFieldsPattern(params): |
224 """Returns the Django pattern for this View's entity |
224 """Returns the Django pattern for this View's entity. |
225 |
225 |
226 Params usage: |
226 Params usage: |
227 key_fields_prefix: The key_fields_prefix value is used as the |
227 key_fields_prefix: The key_fields_prefix value is used as the |
228 first part of the returned pattern. |
228 first part of the returned pattern. |
229 """ |
229 """ |
230 |
230 |
231 names = params['logic'].getKeyFieldNames() |
231 names = params['logic'].getKeyFieldNames() |
232 patterns = params['key_fields_prefix'] |
232 patterns = params['key_fields_prefix'] |
233 |
233 |