| Conditions | 1 | 
| Total Lines | 63 | 
| Code Lines | 46 | 
| 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 -*-  | 
            ||
| 47 | def __init__(self, context, request):  | 
            ||
| 48 | super(VaccinationCentersView, self).__init__(context, request)  | 
            ||
| 49 | |||
| 50 | self.catalog = SETUP_CATALOG  | 
            ||
| 51 | self.contentFilter = dict(  | 
            ||
| 52 | portal_type="VaccinationCenter",  | 
            ||
| 53 | sort_on="sortable_title"  | 
            ||
| 54 | )  | 
            ||
| 55 | |||
| 56 |         self.context_actions = { | 
            ||
| 57 |             _("Add"): { | 
            ||
| 58 | "url": "createObject?type_name=VaccinationCenter",  | 
            ||
| 59 | "permission": AddVaccinationCenter,  | 
            ||
| 60 | "icon": "++resource++bika.lims.images/add.png"}  | 
            ||
| 61 | }  | 
            ||
| 62 | |||
| 63 |         self.title = self.context.translate(_("Vaccination Centers")) | 
            ||
| 64 |         self.icon = "{}/{}".format( | 
            ||
| 65 | self.portal_url,  | 
            ||
| 66 | "/++resource++bika.health.images/vaccinationcenter_big.png"  | 
            ||
| 67 | )  | 
            ||
| 68 | |||
| 69 | self.show_select_row = False  | 
            ||
| 70 | self.show_select_column = True  | 
            ||
| 71 | self.pagesize = 50  | 
            ||
| 72 | |||
| 73 | self.columns = collections.OrderedDict((  | 
            ||
| 74 |             ("Name", { | 
            ||
| 75 |                 "title": _("Name"), | 
            ||
| 76 | "index": "sortable_title"  | 
            ||
| 77 | }),  | 
            ||
| 78 |             ("Email", { | 
            ||
| 79 |                 "title": _("Email"), | 
            ||
| 80 | "toggle": True  | 
            ||
| 81 | }),  | 
            ||
| 82 |             ("Phone", { | 
            ||
| 83 |                 "title": _("Phone"), | 
            ||
| 84 | "toggle": True  | 
            ||
| 85 | }),  | 
            ||
| 86 |             ("Fax", { | 
            ||
| 87 |                 "title": _("Fax"), | 
            ||
| 88 | "toggle": True  | 
            ||
| 89 | }),  | 
            ||
| 90 | ))  | 
            ||
| 91 | |||
| 92 | self.review_states = [  | 
            ||
| 93 |             { | 
            ||
| 94 | "id":"default",  | 
            ||
| 95 |                 "title": _("Active"), | 
            ||
| 96 |                 "contentFilter": {"is_active": True}, | 
            ||
| 97 |                 "transitions": [{"id": "deactivate"}, ], | 
            ||
| 98 | "columns": self.columns.keys(),  | 
            ||
| 99 |             }, { | 
            ||
| 100 | "id":"inactive",  | 
            ||
| 101 |                 "title": _("Dormant"), | 
            ||
| 102 |                 "contentFilter": {"is_active": False}, | 
            ||
| 103 |                 "transitions": [{"id": "activate"}, ], | 
            ||
| 104 | "columns": self.columns.keys(),  | 
            ||
| 105 |             }, { | 
            ||
| 106 | "id":"all",  | 
            ||
| 107 |                 "title": _("All"), | 
            ||
| 108 |                 "contentFilter":{}, | 
            ||
| 109 | "columns": self.columns.keys(),  | 
            ||
| 110 | },  | 
            ||
| 150 |