Total Complexity | 1 |
Total Lines | 10 |
Duplicated Lines | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | from django.contrib.auth.tokens import default_token_generator |
||
25 | View Code Duplication | class PasswordResetEmail(BaseEmailMessage): |
|
26 | template_name = 'email/password_reset.html' |
||
27 | |||
28 | def set_context_data(self): |
||
29 | super(PasswordResetEmail, self).set_context_data() |
||
30 | |||
31 | user = self.context.get('user') |
||
32 | self.context['uid'] = utils.encode_uid(user.pk) |
||
33 | self.context['token'] = default_token_generator.make_token(user) |
||
34 | self.context['url'] = settings.ACTIVATION_URL.format(**self.context) |
||
35 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.