| Conditions | 1 |
| Total Lines | 67 |
| Code Lines | 56 |
| 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 -*- |
||
| 43 | def __init__(self, context, request): |
||
| 44 | super(AuditLogView, self).__init__(context, request) |
||
| 45 | |||
| 46 | self.catalog = "auditlog_catalog" |
||
| 47 | |||
| 48 | self.contentFilter = { |
||
| 49 | "sort_on": "snapshot_created", |
||
| 50 | "sort_order": "desscending", |
||
| 51 | } |
||
| 52 | |||
| 53 | self.context_actions = {} |
||
| 54 | |||
| 55 | self.title = self.context.translate(_("Audit Log")) |
||
| 56 | self.icon = "{}/{}".format( |
||
| 57 | self.portal_url, |
||
| 58 | "/++resource++bika.lims.images/auditlog_big.png" |
||
| 59 | ) |
||
| 60 | |||
| 61 | self.show_select_column = False |
||
| 62 | self.pagesize = 25 |
||
| 63 | |||
| 64 | self.columns = collections.OrderedDict(( |
||
| 65 | ("title", { |
||
| 66 | "title": _("Title"), |
||
| 67 | "index": "title"}), |
||
| 68 | ("version", { |
||
| 69 | "title": _("Version"), |
||
| 70 | "index": "snapshot_version", |
||
| 71 | "sortable": True}), |
||
| 72 | ("modified", { |
||
| 73 | "title": _("Date Modified"), |
||
| 74 | "index": "modified", |
||
| 75 | "sortable": True}), |
||
| 76 | ("actor", { |
||
| 77 | "title": _("Actor"), |
||
| 78 | "index": "actor", |
||
| 79 | "sortable": True}), |
||
| 80 | ("fullname", { |
||
| 81 | "title": _("Fullname"), |
||
| 82 | "index": "fullname", |
||
| 83 | "sortable": True}), |
||
| 84 | ("roles", { |
||
| 85 | "title": _("Roles"), |
||
| 86 | "sortable": False, |
||
| 87 | "toggle": False}), |
||
| 88 | ("remote_address", { |
||
| 89 | "title": _("Remote IP"), |
||
| 90 | "sortable": True}), |
||
| 91 | ("action", { |
||
| 92 | "title": _("Action"), |
||
| 93 | "index": "action", |
||
| 94 | "sortable": True}), |
||
| 95 | ("review_state", { |
||
| 96 | "title": _("Workflow State"), |
||
| 97 | "index": "review_state", |
||
| 98 | "sortable": True}), |
||
| 99 | ("diff", { |
||
| 100 | "title": _("Changes"), |
||
| 101 | "sortable": False}), |
||
| 102 | )) |
||
| 103 | |||
| 104 | self.review_states = [ |
||
| 105 | { |
||
| 106 | "id": "default", |
||
| 107 | "title": _("Active"), |
||
| 108 | "contentFilter": {}, |
||
| 109 | "columns": self.columns.keys(), |
||
| 110 | } |
||
| 206 |