-
-
-
-
-
-
reviewboard/reviews/views.py (Diff revision 1) Col: 22 E261 at least two spaces before inline comment
-
reviewboard/reviews/views.py (Diff revision 1) Col: 64 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 31 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 34 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 37 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 40 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 60 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 27 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 30 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 33 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 36 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 24 E261 at least two spaces before inline comment
-
reviewboard/reviews/views.py (Diff revision 1) Col: 64 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 26 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 29 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 32 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 35 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 60 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 26 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 29 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 32 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 35 E226 missing whitespace around arithmetic operator
-
reviewboard/reviews/views.py (Diff revision 1) Col: 10 E261 at least two spaces before inline comment
-
reviewboard/reviews/views.py (Diff revision 1) Col: 64 E226 missing whitespace around arithmetic operator
-
-
reviewboard/reviews/views.py (Diff revision 1) Col: 13 E122 continuation line missing indentation or outdented
-
reviewboard/reviews/views.py (Diff revision 1) Col: 60 E226 missing whitespace around arithmetic operator
-
User Infobox Improvements
Review Request #7662 — Created Sept. 26, 2015 and discarded
Information | |
---|---|
chronicleyu | |
Review Board | |
master | |
Reviewers | |
reviewboard, students | |
brennie, chipx86, david, mike_conley |
When hovering over a user's name, an info box appears showing their avatar/photo, name, e-mail address, and some other information. It's somewhat useful, but could be more useful.
This change adds a couple new pieces of information:1) Their timezone and how many hours ahead/behind you they are (to help determine if they'd be available at the moment).
2) Some review request stats (how many review requests they have been assigned to, and how many they have had out for review).A new
UserInfoExtensionHook
is also created to provide additional information, and associated entity tag data, for this box, should the need arise. That way, third-parties can integrate other services they use with this box. Documentation and example usage for the new hook are also provided.
Moused over usernames to verify that the infobox appears with the new (and old) pieces of information displays correctly.
Overrodeget_extra_context
to ensure that additional information added via the extension hook displays correctly.
Description | From | Last Updated |
---|---|---|
Just saying how far ahead/behind forces me to do math. Can we imitate what Slack does? They have: <clock symbol> … |
|
|
There's a mismatch in styles here. We should aim for consistency, or separate them out more by whitespace. Also, the … |
|
|
Now that we're showing this using a time notation, we can probably skip the word "hours" ("4:00 hours" seems weird, … |
|
|
'tzinfo' imported but unused |
![]() |
|
'timedelta' imported but unused |
![]() |
|
Col: 47 E231 missing whitespace after ',' |
![]() |
|
Col: 5 E303 too many blank lines (2) |
![]() |
|
Col: 22 E261 at least two spaces before inline comment |
![]() |
|
Col: 64 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 31 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 34 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 37 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 40 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 60 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 27 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 30 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 33 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 36 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 24 E261 at least two spaces before inline comment |
![]() |
|
Col: 64 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 26 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 29 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 32 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 35 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 60 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 26 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 29 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 32 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 35 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 10 E261 at least two spaces before inline comment |
![]() |
|
Col: 64 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 75 E225 missing whitespace around operator |
![]() |
|
Col: 13 E122 continuation line missing indentation or outdented |
![]() |
|
Col: 60 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 75 E225 missing whitespace around operator |
![]() |
|
These imports need to be broken up. We organize our imports as following: from __future__ import unicode_literals # Standard library … |
|
|
'django' imported but unused |
![]() |
|
No blank line here. |
|
|
Col: 32 E225 missing whitespace around operator |
![]() |
|
Col: 28 E226 missing whitespace around arithmetic operator |
![]() |
|
Col: 36 E225 missing whitespace around operator |
![]() |
|
Col: 42 E226 missing whitespace around arithmetic operator |
![]() |
|
This should be six.text_type (i.e., unicode) instead of str. Also This will have to use fomratting so we can localize … |
|
|
Col: 36 E225 missing whitespace around operator |
![]() |
|
Col: 5 E303 too many blank lines (3) |
![]() |
|
Col: 57 E225 missing whitespace around operator |
![]() |
|
I would break this up as: 'users_stats': { 'assigned': num_requests_assigned, 'posted': num_requests_posted, # ... } Then you can do the … |
|
|
Col: 1 W391 blank line at end of file |
![]() |
|
Col: 15 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 15 E126 continuation line over-indented for hanging indent |
![]() |
|
Col: 15 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 15 E126 continuation line over-indented for hanging indent |
![]() |
|
Col: 15 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 15 E126 continuation line over-indented for hanging indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
No need to sign your work here. :) |
|
|
This is essentially the same value as requsr_dttemp. Can't we re-use the same value for both, and just call it … |
|
|
Converting the UTC datetime into a string and then extracting things from the string and converting them back into integers … |
|
|
I think it'd maybe make more sense do put the tz and hours values into the context and pass them … |
|
|
We already have the user, no? |
|
|
It seems to me we should be able to narrow down the review_requests with a QuerySet to find the cases … |
|
|
I think we should be fine to pass these down to the template as ints. |
|
|
"Assigned:" and "Posted:" aren't going to be translated. Let's send down just the raw integers, and do the translation in … |
|
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
undefined name 'e' |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 W292 no newline at end of file |
![]() |
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
Col: 58 E251 unexpected spaces around keyword / parameter equals |
![]() |
|
Col: 60 E251 unexpected spaces around keyword / parameter equals |
![]() |
|
Col: 22 E225 missing whitespace around operator |
![]() |
|
Col: 5 E303 too many blank lines (2) |
![]() |
|
Col: 5 E265 block comment should start with '# ' |
![]() |
|
Col: 28 E226 missing whitespace around arithmetic operator |
![]() |
|
"HTML" |
|
|
A couple things: 1) When showing examples like this, we want them in literal blocks. 2) I have no idea … |
|
|
This shouldn't be here. |
|
|
These docs, just like the ones above, will be generated and made available on our site. This needs to be … |
|
|
No blank line here. |
|
|
This shouldn't take a list of sections. That's going to lock us into a particular design, and it's going to … |
|
|
Missing a docstring. No blank line here. |
|
|
Two blank lines here. |
|
|
Col: 1 E302 expected 2 blank lines, found 1 |
![]() |
|
This is a third-party module. |
|
|
This must be inserted alphabetically. |
|
|
This blank line must remain. |
|
|
I'm going to want to see all this logic heavily documented, so every bit of it is clear. |
|
|
What's all this? |
|
|
<html> means the start of a document. We never want that, or we'll confuse browsers. |
|
|
On a large deployment, this may produce thousands or tens of thousands of review requests. Since we're just counting, we … |
|
|
Blank line between these. |
|
|
Missing a trailing comma. |
|
|
These should be one statemnet. |
|
|
Make sure all the content aligns properly with the current indentation level. |
|
|
'format_html' imported but unused |
![]() |
|
'mark_safe' imported but unused |
![]() |
|
Col: 39 E231 missing whitespace after ',' |
![]() |
|
Col: 9 E303 too many blank lines (2) |
![]() |
|
Col: 80 E501 line too long (80 > 79 characters) |
![]() |
|
Col: 17 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
Col: 13 E123 closing bracket does not match indentation of opening bracket's line |
![]() |
|
Col: 43 E231 missing whitespace after ',' |
![]() |
|
Col: 51 E202 whitespace before ')' |
![]() |
|
This should start with .. code-block:: python |
|
|
Docstrings should start with a 1-line summary, then a blank line, then additional paragraphs of explanation. |
|
|
We should check that template_name is a string, because otherwise we'll call render_to_string and pass it None. Alternatively, just get … |
|
|
ExtensionHook doesn't define get_extra_context so the super call is superfluous and useless. |
|
|
Remove this line. |
|
|
We should just include the <span> in the template, instead of passing it in like this. |
|
|
Please put this line back. |
|
|
'format_html' imported but unused |
![]() |
|
This should line up with the c in code-block. |
|
|
This should line up with the c in code-block. |
|
|
Can you reformat this as follows? raise ValueError( 'Invalid UserInfoBox section: %s; must be one of %s' % (section, ', … |
|
|
Can you reformat this as: return render_to_string(self.template_name, RequestContext(request, context)) It's easier to read this way. |
|
|
Remove this line. |
|
|
This comment is unnecessary. |
|
|
Single quotes. Also, this should be six.text_type, not str: from django.utils import six The reason we use this is that … |
|
|
Can you put UserInfoBoxHook.render on one line? that way its clear there is not supposed to be a space between … |
|
|
This should be '... extension: "', extension.id, e, exc_info=True) (I know some places use exc_info=1, but we aren't doing that … |
|
|
This blank line isn't necessary when there's no docstring. |
|
|
I'm not sure what "custom parameters..." means here, and it's not something that users can change (since render chooses what … |
|
|
get_extra_context should return a dict, not a str. |
|
|
Col: 25 E128 continuation line under-indented for visual indent |
![]() |
|
There are fractional time zones that aren't 30 minutes (for example, Kathmandu, Nepal is GMT +5:45). I don't think this … |
|
|
We should pass the raw numbers in to the template and put the text there. |
|
|
As is, this won't include any of the arguments because the first argument doesn't have any format specifiers. You can … |
|
|
Col: 30 E201 whitespace after '(' |
![]() |
|
local variable 'e' is assigned to but never used |
![]() |
|
How about the following: # We round the timezones while minutes >= 10: if ahead: hr_diff += 0.25 else: hr_diff … |
|
|
elif |
|
|
When interpolating only one variable, you don't need to use dict interpolation. |
|
|
So string additions are slow. How about: custom_info_parts = [] for hook in UserInfoBoxHooks.hooks: try: custom_info_parts.append(hook.render(user, request)) except Exception: # … |
|
|
We want to make sure that this isn't going to be escaped incorrectly. We should be checking if the result … |
|
|
extension.id on next line. |
|
|
Can we move all of this computation to happen after the etag_if_none_match call? We don't want to do this if … |
|
|
I suspect we should show something else (or not show this at all) if request.user is the same as user. … |
|
|
Can we localize this? We also should be able to skip the six.text_type call. td_msg = _('Same local time as … |
|
|
I know the existing text in here isn't localized, but we should mark these words (and the others in here) … |
|
|
If you do: :py:class:`~reviewboard.extensions.hooks.UserInfoHook` it will still link to the right class, but it will render as UserInfoHook. |
|
|
get_extra_context should return a rst :py:class:`dict`. |
|
|
Double backquotes |
|
|
Double backquotes |
|
|
No blank line here. |
|
|
six.text_type, not unicode. (from django.util import six) |
|
|
How about: review_requests_sent = ( ReviewRequest.objects .public(user=request.user) .filter(submitter=user) .count() ) Does this include ALL sent rrs or only the open … |
|
|
Why are you casting this to a string? Does this include ALL assigned rrs or only open? |
|
|
Maybe we should we leave it up to the hook to return their strings as marked safe? |
|
|
Col: 13 E131 continuation line unaligned for hanging indent |
![]() |
|
"A :py:class:`~reviewboard.extensions.hooks.UserInfoBoxHook` can be used..." |
|
|
Blank space after comma |
|
|
"to return a :py:class:`dict`. The result of this function will be used, in addition to the request and user, for … |
|
|
Should comment out the dots because its not valid python. |
|
|
Provide an actual example. |
|
|
backquotes around the strings, e.g. * ``'user-identity'`` * ``'extra-details'`` |
|
|
If required, :py:meth:`get_extra_context` may be overridden ... |
|
|
If required, :py:meth:`get_extra_context` may be overridden ... |
|
|
Can we call this SECTIONS instead? |
|
|
Col: 33 E128 continuation line under-indented for visual indent |
![]() |
|
All comments should be complete sentences and should end in periods. This goes for all comments in this method. |
|
|
requser? How about target_user? |
|
|
Instead of my_user, lets call it user or local_user |
|
|
This isn't a very useful comment. |
|
|
This is not a complete sentence. |
|
|
We should probably wrap this in an {% if custom_info %}. Also class="custom-info" |
|
|
Col: 13 E128 continuation line under-indented for visual indent |
![]() |
|
We should call this SECTIONS |
|
|
We should indent this as: return mark_safe( render_to_string(self.template_name, RequestContext(request, context))) |
|
|
Col: 17 E128 continuation line under-indented for visual indent |
![]() |
|
There's no need to cast this to a string. |
|
|
We don't seem to be splitting this into the different sections. |
|
|
The etag needs to take into account the time difference and stats, and probably the extension hook stuff as well. … |
|
|
According to the raw diff, you removed a newline from the last line. Please add it back. |
|
|
Unnecessary. |
|
|
Can we just call this user_tz? |
|
|
Unnecessary |
|
|
This isn't the entity tag. You have to call encode_etag on the result. |
|
|
Can you just put one, larger comment above the timezone calculation stuff? We don't need comments every few lines -- … |
|
|
Unnecessary. |
|
|
Unnecessary. |
|
|
No blank line here. |
|
|
Unnecessary. |
|
|
Get. |
|
|
Unnecessary. |
|
|
"custom rendering context" |
|
|
"In this case, the get_etag_data should be overridden to return data that will be used to generate the entity tag … |
|
|
"Get" |
|
|
Remove this. |
|

Change Summary:
Reworked hour difference code to use the "datetime, ptyz, and utcoffset" method, halfway through working on user's RR stats component of the project
Description: |
|
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||
Diff: |
Revision 2 (+133) |
|||||||||||||||
Removed Files: |

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html
-
-
-
reviewboard/reviews/views.py (Diff revision 2) Col: 28 E226 missing whitespace around arithmetic operator
-
-
reviewboard/reviews/views.py (Diff revision 2) Col: 42 E226 missing whitespace around arithmetic operator
-
-
-
-
-
-
reviewboard/reviews/views.py (Diff revision 2) These imports need to be broken up. We organize our imports as following:
from __future__ import unicode_literals # Standard library imports like logging, time, etc. # Third-party library imports like django, pytz, etc. # reviewboard.* imports
-
-
reviewboard/reviews/views.py (Diff revision 2) This should be
six.text_type
(i.e.,unicode
) instead ofstr
.Also This will have to use fomratting so we can localize the strings, e.g.
from django.utils.translation import ugettext as _ # ... if hr_diff < 0: td_msg = (_('%(tz)s: %(hours)s hours ahead of you') % { 'tz': requsr_tz, 'hours': -1 * hr_diff }) elif hr_diff > 0: # ...
-
reviewboard/reviews/views.py (Diff revision 2) I would break this up as:
'users_stats': { 'assigned': num_requests_assigned, 'posted': num_requests_posted, # ... }
Then you can do the formatting in the infobox with
{% blocktrans %} .... {% endblocktrans %}
so that it gets localized.
Change Summary:
Completed the functionality to display user RR statistics.
Description: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 3 (+72 -3) |

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E126 continuation line over-indented for hanging indent
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E126 continuation line over-indented for hanging indent
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 4) Col: 15 E126 continuation line over-indented for hanging indent
Change Summary:
Fixed the td_msg indentation issues brought up by ReviewBot
Diff: |
Revision 5 (+84 -3) |
---|

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html
-
reviewboard/reviews/views.py (Diff revision 5) Col: 13 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 5) Col: 13 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 5) Col: 13 E128 continuation line under-indented for visual indent

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/accounts/user_infobox.html
Change Summary:
WIP: Adding UserInfoBoxExtensionHook
Description: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 7 (+121 -4) |

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html
-
-
reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 7) Col: 1 E302 expected 2 blank lines, found 1
-
-
reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 7) Col: 13 E128 continuation line under-indented for visual indent
-
reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 7) Col: 13 W292 no newline at end of file
-
-
-
reviewboard/reviews/views.py (Diff revision 6) This is essentially the same value as requsr_dttemp.
Can't we re-use the same value for both, and just call it "now" or "utc_now"?
utc_now = datetime.datetime.now(pytz.utc)
-
reviewboard/reviews/views.py (Diff revision 6) Converting the UTC datetime into a string and then extracting things from the string and converting them back into integers to do math seems suboptimal.
I'm reasonably certain that we can extract the values that we need from the return value of datetime.now(pytz.utc) and similar.
Example:
now = datetime.datetime.now(pytz.utc) other_user_tz = pytz.timezone(user.get_profile().timezone) other_user_time = now.astimezone(other_user_tz) my_user_tz = pytz.timezone(request.user.get_profile().timezone) my_user_time = now.astimezone(my_user_tz)
Can we not then get the timedelta's that we want in seconds, and then convert to minutes / hours, to generate the values that we need?
Also, you might find this interesting: http://stackoverflow.com/questions/14190045/how-to-convert-datetime-timedelta-to-minutes-hours-in-python
-
reviewboard/reviews/views.py (Diff revision 6) I think it'd maybe make more sense do put the tz and hours values into the context and pass them into the template, and then insert them with the translation strings in the template, instead of just sending down the translated strings from the view.
-
-
reviewboard/reviews/views.py (Diff revision 6) It seems to me we should be able to narrow down the review_requests with a QuerySet to find the cases where rr.submitter == user. QuerySet docs: https://docs.djangoproject.com/en/1.6/topics/db/queries/
-
reviewboard/reviews/views.py (Diff revision 6) I think we should be fine to pass these down to the template as ints.
-
reviewboard/reviews/views.py (Diff revision 6) "Assigned:" and "Posted:" aren't going to be translated.
Let's send down just the raw integers, and do the translation in the views.
Change Summary:
Added extension hook and documentation for using the hook. Made changes to UI and calculation method for time difference
Description: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 8 (+304 -7) |
|||||||||||||||||||||||||||
Removed Files: |
||||||||||||||||||||||||||||
Added Files: |

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/templates/accounts/user_infobox.html docs/codebase/index.rst~ Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/templates/accounts/user_infobox.html docs/codebase/index.rst~
-
-
reviewboard/extensions/hooks.py (Diff revision 8) Col: 58 E251 unexpected spaces around keyword / parameter equals
-
reviewboard/extensions/hooks.py (Diff revision 8) Col: 60 E251 unexpected spaces around keyword / parameter equals
-
-
-
-
reviewboard/reviews/views.py (Diff revision 8) Col: 28 E226 missing whitespace around arithmetic operator
Change Summary:
Reviewbot fixes.

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/templates/accounts/user_infobox.html docs/codebase/index.rst~ Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/templates/accounts/user_infobox.html docs/codebase/index.rst~
-
-
Looks like you have some files in here (the documentation ending with a
~
) that you probably didn't mean to have. -
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 9) A couple things:
1) When showing examples like this, we want them in literal blocks.
2) I have no idea what this section is trying to say, so an extension author is going to be even more confused. Saying<html>...</html>
suggests an entire HTML page will be in there.It's better to use more concrete examples and to explain the structure in words.
-
-
reviewboard/extensions/hooks.py (Diff revision 9) These docs, just like the ones above, will be generated and made available on our site. This needs to be more explanatory, like above.
-
-
reviewboard/extensions/hooks.py (Diff revision 9) This shouldn't take a list of sections. That's going to lock us into a particular design, and it's going to be hard to adapt this to any future changes.
I also don't think it's useful to take pre-defined strings. Infoboxes aren't going to show a single static string. They're going to need to compute things for the given user.
I'd suggest a different design for the hook:
1) Each
UserInfoBoxHook
should be about showing one single thing, not multiple things. Extensions can always instantiate more than one hook.
2) The constructor should take only two things: 1) A section indicator (represented by a constant on this class indicating the section name -- this would be mapped to a string like "header", etc.), and 2) an optional template name.
3) Therender
function below needs to take the user (since an extension will be basing info on the user), and should default to rendering the provided template with the request and user as context. However, the documentation should state thatrender
can be overridden to provide custom rendering.This should not take
is_enabled
, as it makes no sense to instantiate a hook and just keep it disabled.We also need to rethink the sections. "header", "body", "footer" locks us into that model for the infobox, meaning we can't shuffle it later. For instance, say we want to make some of this appear side-by-side. "Footer" no longer makes sense there.
Instead, let's go with "user-identity" (names, e-mail, possibly department, etc.), and "extra-details". I think going with a third doesn't make a lot of sense right now.
-
-
-
-
-
-
reviewboard/reviews/views.py (Diff revision 9) I'm going to want to see all this logic heavily documented, so every bit of it is clear.
-
-
reviewboard/reviews/views.py (Diff revision 9) <html>
means the start of a document. We never want that, or we'll confuse browsers. -
reviewboard/reviews/views.py (Diff revision 9) On a large deployment, this may produce thousands or tens of thousands of review requests.
Since we're just counting, we want to let the database handle this. We also don't need to re-check the user, since that's already part of the query. So:
review_requests_sent = ReviewRequest.objects.public(user=user).count()
-
-
-
-
reviewboard/templates/accounts/user_infobox.html (Diff revision 9) Make sure all the content aligns properly with the current indentation level.
Change Summary:
Overhaul of the extension hook code and minor infobox UI improvements.
Summary: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||||||||
Groups: |
|
|||||||||||||||||||||||||||||||||
Diff: |
Revision 10 (+241 -10)
|
|||||||||||||||||||||||||||||||||
Removed Files: |
||||||||||||||||||||||||||||||||||
Added Files: |

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
-
-
-
-
-
-
reviewboard/extensions/hooks.py (Diff revision 10) Col: 17 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 10) Col: 13 E128 continuation line under-indented for visual indent
-
reviewboard/reviews/views.py (Diff revision 10) Col: 13 E123 closing bracket does not match indentation of opening bracket's line
-
Change Summary:
Fixed ReviewBot errors which appeared after the previous post.
Diff: |
Revision 11 (+241 -9)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
Change Summary:
Added documentation on extending the UserInfoBoxHook. Minor fixes to issues raised about the code in views.py.
Description: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 12 (+226 -9)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
-
Change Summary:
Fixed a whitespace issue in views.py from ReviewBot
Diff: |
Revision 13 (+226 -9)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/ui/datagrids.less reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
-
To remove a file from your review request you can do:
git rm <filename> git commit -m "Removed <filename>" rbt post -r 7662
Also, you're going to want to add backup files to your global
.gitignore
or turn them off in your.vimrc
. To do the former (a good idea), add the following to your~/.gitconfig
:[core] excludesfile = ~/.gitignore_global
And then create a
~/.gitignore_global
file with the following:*~
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 13) This should start with
.. code-block:: python
-
reviewboard/extensions/hooks.py (Diff revision 13) Docstrings should start with a 1-line summary, then a blank line, then additional paragraphs of explanation.
-
reviewboard/extensions/hooks.py (Diff revision 13) We should check that
template_name
is a string, because otherwise we'll callrender_to_string
and pass itNone
. Alternatively, just get rid of the default value for the parameter to force people to pass it in. -
reviewboard/extensions/hooks.py (Diff revision 13) ExtensionHook
doesn't defineget_extra_context
so the super call is superfluous and useless. -
-
reviewboard/reviews/views.py (Diff revision 13) We should just include the
<span>
in the template, instead of passing it in like this. -
Change Summary:
Minor fixes to extension hook architecture and infobox UI. Changes to extension hook docstring in hooks.py.
Description: |
|
|||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 14 (+227 -6)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
-
Change Summary:
Removed unused import from views.py
Diff: |
Revision 15 (+226 -5)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: reviewboard/templates/accounts/user_infobox.html docs/codebase/generating-documentation.rst~ docs/manual/extending/extensions/hooks/index.rst reviewboard/static/rb/css/common.less docs/codebase/index.rst~ docs/manual/extending/extensions/hooks/user-infobox-hook.rst
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 15) This should line up with the
c
incode-block
. -
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 15) This should line up with the
c
incode-block
. -
reviewboard/extensions/hooks.py (Diff revision 15) Can you reformat this as follows?
raise ValueError( 'Invalid UserInfoBox section: %s; must be one of %s' % (section, ', '.join(UserInfoBoxHook.SECTION_OPTIONS))
This avoids the text wrapping. We also prefer
%
-formatting parameters to appear on the next line when the string is long enough to warrant it. -
reviewboard/extensions/hooks.py (Diff revision 15) Can you reformat this as:
return render_to_string(self.template_name, RequestContext(request, context))
It's easier to read this way.
-
-
-
reviewboard/reviews/views.py (Diff revision 15) Single quotes. Also, this should be
six.text_type
, notstr
:from django.utils import six
The reason we use this is that we use unicode literals everywhere and
unicode
!=str
. However, in Python 3,unicode
was renamed tostr
andstr
was renamed tobytes
. We usesix.text_type
so that when we eventually transition to Py3, we will have less headaches. -
reviewboard/reviews/views.py (Diff revision 15) Can you put
UserInfoBoxHook.render
on one line? that way its clear there is not supposed to be a space between them. -
reviewboard/reviews/views.py (Diff revision 15) This should be
'... extension: "', extension.id, e, exc_info=True)
(I know some places use
exc_info=1
, but we aren't doing that moving forward.)
Change Summary:
Removed the files which were accidentally added to the review request.
Diff: |
Revision 16 (+205 -5)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
Change Summary:
Removed unnecessary lines and reformatted wrapping text in views.py and hooks.py. Fixed indenting in extension hook documentation.
Diff: |
Revision 17 (+204 -5)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
reviewboard/extensions/hooks.py (Diff revision 17) Col: 25 E128 continuation line under-indented for visual indent
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 17) This blank line isn't necessary when there's no docstring.
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 17) I'm not sure what "custom parameters..." means here, and it's not something that users can change (since
render
chooses what to pass in). We should listuser, request
. -
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 17) get_extra_context
should return a dict, not a str. -
reviewboard/reviews/views.py (Diff revision 17) There are fractional time zones that aren't 30 minutes (for example, Kathmandu, Nepal is GMT +5:45). I don't think this will do the right thing for those.
-
reviewboard/reviews/views.py (Diff revision 17) We should pass the raw numbers in to the template and put the text there.
-
reviewboard/reviews/views.py (Diff revision 17) As is, this won't include any of the arguments because the first argument doesn't have any format specifiers. You can also simplify it using
logging.exception
:logging.exception('Error when running UserInfoBoxHook.render in ' 'extension %s', extension.id)
Change Summary:
Extension hook documentation changes. Also, hour difference calculation now rounds to the nearest quarter of an hour. Minor fixes to code in hooks.py, views.py and infobox template.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 18 (+220 -5)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
Change Summary:
ReviewBot fixes to views.py.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 19 (+220 -5)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
reviewboard/reviews/views.py (Diff revision 19) How about the following:
# We round the timezones while minutes >= 10: if ahead: hr_diff += 0.25 else: hr_diff -= 0.25 minutes -= 15
This will have the same effect, but be much shorter.
Also, personally I'd much rather see
5:45 hours ahead of you
instead of5.75 hours ahead of you
. -
-
reviewboard/reviews/views.py (Diff revision 19) When interpolating only one variable, you don't need to use
dict
interpolation. -
reviewboard/reviews/views.py (Diff revision 19) So string additions are slow. How about:
custom_info_parts = [] for hook in UserInfoBoxHooks.hooks: try: custom_info_parts.append(hook.render(user, request)) except Exception: # ... custom_info = ''.join(custom_info_parts)
-
reviewboard/reviews/views.py (Diff revision 19) We want to make sure that this isn't going to be escaped incorrectly. We should be checking if the result of
hook.render
is aSafeString
or not. If not, it should beescaped
so that we only deal withSafeString
s. -
Change Summary:
Changes to hour difference display formatting and hook processing.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 20 (+175 -5)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Removed Files: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Added Files: |

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
Now that we're showing this using a time notation, we can probably skip the word "hours" ("4:00 hours" seems weird, and "4:30 hours" seems weirder)
-
reviewboard/reviews/views.py (Diff revision 20) Can we move all of this computation to happen after the
etag_if_none_match
call? We don't want to do this if the user's browser already has it cached. -
reviewboard/reviews/views.py (Diff revision 20) I suspect we should show something else (or not show this at all) if
request.user
is the same asuser
. I know I'm in my own timezone! -
reviewboard/reviews/views.py (Diff revision 20) Can we localize this? We also should be able to skip the
six.text_type
call.td_msg = _('Same local time as you (%s)') % requsr_tz
-
reviewboard/templates/accounts/user_infobox.html (Diff revision 20) I know the existing text in here isn't localized, but we should mark these words (and the others in here) for translation. I think we should also put assigned/posted on separate lines.
Change Summary:
Text localization fixes and rearrangement of code in views.py. Minor infobox UI changes.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 21 (+176 -5)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Removed Files: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Added Files: |

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 21) If you do:
:py:class:`~reviewboard.extensions.hooks.UserInfoHook`
it will still link to the right class, but it will render as
UserInfoHook
. -
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 21) get_extra_context
should return a
rst :py:class:`dict`
. -
-
-
-
reviewboard/reviews/views.py (Diff revision 21) six.text_type
, notunicode
.(
from django.util import six
) -
reviewboard/reviews/views.py (Diff revision 21) How about:
review_requests_sent = ( ReviewRequest.objects .public(user=request.user) .filter(submitter=user) .count() )
Does this include ALL sent rrs or only the open ones?
-
reviewboard/reviews/views.py (Diff revision 21) Why are you casting this to a string?
Does this include ALL assigned rrs or only open?
-
reviewboard/reviews/views.py (Diff revision 21) Maybe we should we leave it up to the hook to return their strings as marked safe?
Change Summary:
Minor fixes to extension hook code and documentation, and to text type in views.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 22 (+179 -5)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
reviewboard/reviews/views.py (Diff revision 22) Col: 13 E131 continuation line unaligned for hanging indent
Change Summary:
Hook rendering now does the
mark_safe
.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 23 (+180 -5)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
reviewboard/extensions/hooks.py (Diff revision 23) Col: 33 E128 continuation line under-indented for visual indent
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 23) "A :py:class:`~reviewboard.extensions.hooks.UserInfoBoxHook` can be used..."
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 23) Blank space after comma
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 23) "to return a :py:class:`dict`. The result of this function will be used, in addition to the request and user, for the template's rendering context."
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 23) Should comment out the dots because its not valid python.
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 23) Provide an actual example.
-
reviewboard/extensions/hooks.py (Diff revision 23) backquotes around the strings, e.g.
* ``'user-identity'`` * ``'extra-details'``
-
reviewboard/extensions/hooks.py (Diff revision 23) If required, :py:meth:`get_extra_context` may be overridden ...
-
reviewboard/extensions/hooks.py (Diff revision 23) If required, :py:meth:`get_extra_context` may be overridden ...
-
-
reviewboard/reviews/views.py (Diff revision 23) All comments should be complete sentences and should end in periods. This goes for all comments in this method.
-
-
-
-
-
reviewboard/templates/accounts/user_infobox.html (Diff revision 23) We should probably wrap this in an
{% if custom_info %}
.Also
class="custom-info"
Change Summary:
Minor fixes to views.py, hooks.py, user_infobox.html, and extension hook documentation. Editted
Description
andTesting Done
sections to be more consistent with commit messages.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 24 (+179 -5)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
reviewboard/extensions/hooks.py (Diff revision 24) Col: 13 E128 continuation line under-indented for visual indent
Change Summary:
Minor ReviewBot under-indent fix.
Diff: |
Revision 25 (+179 -5)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
reviewboard/extensions/hooks.py (Diff revision 25) Col: 17 E128 continuation line under-indented for visual indent
-
-
-
reviewboard/extensions/hooks.py (Diff revision 25) We should indent this as:
return mark_safe( render_to_string(self.template_name, RequestContext(request, context)))
-
-
reviewboard/reviews/views.py (Diff revision 25) We don't seem to be splitting this into the different sections.
Change Summary:
Added minor
common.less
CSS fix to custom info text on infobox. Added code inviews.py
to split custom context into different sections.
Diff: |
Revision 26 (+189 -5)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
reviewboard/reviews/views.py (Diff revision 26) The etag needs to take into account the time difference and stats, and probably the extension hook stuff as well. You should talk to Christian about etags next week.
Change Summary:
Added entity tag updating for timezone info, RR statistics, custom rendering context. Updated extension hook documentation to reflect this change.
Description: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 27 (+211 -8)
|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
Some minor issues, and then I'm happy with this landing.
-
reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 27) According to the raw diff, you removed a newline from the last line. Please add it back.
-
-
-
-
reviewboard/reviews/views.py (Diff revision 27) This isn't the entity tag. You have to call
encode_etag
on the result. -
reviewboard/reviews/views.py (Diff revision 27) Can you just put one, larger comment above the timezone calculation stuff? We don't need comments every few lines -- the code is pretty self explanatory.
-
-
-
-
-
-
Change Summary:
Removed unnecessary blank lines and commenting, and renamed variables associated with the local user's timezone and datetime, in
views.py
. Readded a blank line inrb_extensions.py
.
Diff: |
Revision 28 (+201 -8)
|
---|

-
Tool: Pyflakes Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/extensions/templatetags/rb_extensions.py reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html
-
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 29) "custom rendering context"
-
docs/manual/extending/extensions/hooks/user-infobox-hook.rst (Diff revision 29) "In this case, the
get_etag_data
should be overridden to return data that will be used to generate the entity tag for the infobox. This will help to ensure the infobox is cached correctly." -
-
Change Summary:
Revised extension hook documentation regarding
get_etag_data
inuser-infobox-hook.rst
. Minor fixes and blank line removals inviews.py
.
Diff: |
Revision 30 (+200 -7) |
---|

-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/extensions/hooks.py Ignored Files: docs/manual/extending/extensions/hooks/index.rst docs/manual/extending/extensions/hooks/user-infobox-hook.rst reviewboard/static/rb/css/common.less reviewboard/templates/accounts/user_infobox.html