| Conditions | 1 |
| Total Lines | 52 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | # -*- coding: utf-8 -*- |
||
| 35 | def __init__(self, context, request): |
||
| 36 | super(InterpretationTemplatesView, self).__init__(context, request) |
||
| 37 | |||
| 38 | self.catalog = SETUP_CATALOG |
||
| 39 | |||
| 40 | self.contentFilter = { |
||
| 41 | "portal_type": "InterpretationTemplate", |
||
| 42 | "sort_on": "created", |
||
| 43 | "sort_order": "descending", |
||
| 44 | } |
||
| 45 | |||
| 46 | self.context_actions = { |
||
| 47 | _("Add"): { |
||
| 48 | "url": "++add++InterpretationTemplate", |
||
| 49 | "icon": "add.png"} |
||
| 50 | } |
||
| 51 | |||
| 52 | self.show_select_column = True |
||
| 53 | |||
| 54 | self.columns = collections.OrderedDict(( |
||
| 55 | ("Title", { |
||
| 56 | "title": _("Title"), |
||
| 57 | "index": "sortable_title"}), |
||
| 58 | ("Description", { |
||
| 59 | "title": _("Description"), |
||
| 60 | "index": "Description"}), |
||
| 61 | ("SampleTypes", { |
||
| 62 | "title": _("Sample Types"), |
||
| 63 | "sortable": False}), |
||
| 64 | ("Text", { |
||
| 65 | "title": _("Text"), |
||
| 66 | "sortable": False}), |
||
| 67 | )) |
||
| 68 | |||
| 69 | self.review_states = [ |
||
| 70 | { |
||
| 71 | "id": "default", |
||
| 72 | "title": _("Active"), |
||
| 73 | "contentFilter": {"is_active": True}, |
||
| 74 | "transitions": [], |
||
| 75 | "columns": self.columns.keys(), |
||
| 76 | }, { |
||
| 77 | "id": "inactive", |
||
| 78 | "title": _("Inactive"), |
||
| 79 | "contentFilter": {'is_active': False}, |
||
| 80 | "transitions": [], |
||
| 81 | "columns": self.columns.keys(), |
||
| 82 | }, { |
||
| 83 | "id": "all", |
||
| 84 | "title": _("All"), |
||
| 85 | "contentFilter": {}, |
||
| 86 | "columns": self.columns.keys(), |
||
| 87 | }, |
||
| 128 |