| Conditions | 1 | 
| Total Lines | 60 | 
| 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 -*-  | 
            ||
| 35 | def __init__(self, context, request):  | 
            ||
| 36 | super(ClientContactsView, self).__init__(context, request)  | 
            ||
| 37 | |||
| 38 | self.catalog = "portal_catalog"  | 
            ||
| 39 |         self.contentFilter = { | 
            ||
| 40 | "portal_type": "ClientContact",  | 
            ||
| 41 | "sort_on": "sortable_title",  | 
            ||
| 42 |             "path": { | 
            ||
| 43 | "query": api.get_path(self.context),  | 
            ||
| 44 | "level": 0  | 
            ||
| 45 | }  | 
            ||
| 46 | }  | 
            ||
| 47 | |||
| 48 |         self.context_actions = { | 
            ||
| 49 |             _('Add'): { | 
            ||
| 50 | "url": "++add++ClientContact",  | 
            ||
| 51 | "icon": "++resource++bika.lims.images/add.png",  | 
            ||
| 52 | "permission": AddPortalContent,  | 
            ||
| 53 | }}  | 
            ||
| 54 | |||
| 55 | t = self.context.translate  | 
            ||
| 56 |         self.title = t(_("Contacts")) | 
            ||
| 57 |         self.description = t(_("")) | 
            ||
| 58 | |||
| 59 | icon_path = "/++resource++bika.lims.images/client_contact_big.png"  | 
            ||
| 60 |         self.icon = "{}{}".format(self.portal_url, icon_path) | 
            ||
| 61 | |||
| 62 | self.show_select_column = True  | 
            ||
| 63 | self.pagesize = 50  | 
            ||
| 64 | |||
| 65 | self.columns = OrderedDict((  | 
            ||
| 66 |             ("fullname", { | 
            ||
| 67 |                 "title": _("Full Name"), | 
            ||
| 68 | "index": "getFullname", }),  | 
            ||
| 69 |             ("username", { | 
            ||
| 70 |                 "title": _("User Name"), }), | 
            ||
| 71 |             ("email", { | 
            ||
| 72 |                 "title": _("Email Address"), }), | 
            ||
| 73 |             ("business_phone", { | 
            ||
| 74 |                 "title": _("Business Phone"), }), | 
            ||
| 75 |             ("mobile_phone", { | 
            ||
| 76 |                 "title": _("MobilePhone"), }), | 
            ||
| 77 | ))  | 
            ||
| 78 | |||
| 79 | self.review_states = [  | 
            ||
| 80 |             { | 
            ||
| 81 | "id": "default",  | 
            ||
| 82 |                 "title": _("Active"), | 
            ||
| 83 |                 "contentFilter": {"is_active": True}, | 
            ||
| 84 | "columns": self.columns.keys(),  | 
            ||
| 85 |             }, { | 
            ||
| 86 | "id": "inactive",  | 
            ||
| 87 |                 "title": _("Inactive"), | 
            ||
| 88 |                 "contentFilter": {'is_active': False}, | 
            ||
| 89 | "columns": self.columns.keys(),  | 
            ||
| 90 |             }, { | 
            ||
| 91 | "id": "all",  | 
            ||
| 92 |                 "title": _("All"), | 
            ||
| 93 |                 "contentFilter": {}, | 
            ||
| 94 | "columns": self.columns.keys(),  | 
            ||
| 95 | },  | 
            ||
| 126 |