Make 'rbt status' work better with public local sites.
Review Request #5863 — Created May 22, 2014 and submitted
With public local sites, it's possible that the 'user' link in the session
resource will be broken. This is because the users resource only includes users
who are part of the given local site.This change makes 'rbt status' work a little better in this case. We don't
actually need any data from the user resource, since all we're looking up here
is the username. In this case, we can just use the title attribute of the link,
which also happens to save us an API request.
- Verified that 'rbt status' still works.
- Ran unit tests.
Description | From | Last Updated |
---|---|---|
Can we call this get_link instead? Or get_link_raw or something? |
chipx86 | |
With this patch "resource.links" will return what we want, but "resource['links']" will fail. Generally we've allowed both for fields (e.g. … |
SM smacleod |
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: rbtools/commands/status.py rbtools/api/resource.py rbtools/utils/users.py Ignored Files:
- Testing Done:
-
~ Verified that 'rbt status' still works.
~ - Verified that 'rbt status' still works.
+ - Ran unit tests.
- Commit:
-
eaf41d7d865e6f1502facc786857f202f73fee15bcb3468b74cace2c0d79bda4176aac636eb5b5d7
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: rbtools/commands/status.py rbtools/commands/patch.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/utils/users.py Ignored Files:
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: rbtools/commands/status.py rbtools/commands/patch.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/utils/users.py Ignored Files:
-
-
Instead of making links public, how would you feel about capturing attribute access of links and giving out a "ResourceDictField" object. That way when the particular link is accessed you get a "ResourceLinkField" back. See https://github.com/reviewboard/rbtools/blob/b64f6a42cc2ec562b08904b9b861b173c3937d89/rbtools/api/resource.py#L206
- Change Summary:
-
Switch to exposing links as a ResourceDictField.
- Commit:
-
bcb3468b74cace2c0d79bda4176aac636eb5b5d78f2ad818832f9c1370638e8dc90f04b7f5a7207d
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: rbtools/commands/status.py rbtools/api/resource.py rbtools/utils/users.py Ignored Files:
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: rbtools/commands/status.py rbtools/api/resource.py rbtools/utils/users.py Ignored Files:
-
I'm happy with the code, I think we should add some documentation though.
-
With this patch "resource.links" will return what we want, but "resource['links']" will fail.
Generally we've allowed both for fields (e.g. "review_request_resource['status']" and "review_request_resource.status") so there could be confusion if "links" doesn't work in the same way.
I'm fine with treating links specially and only having ".links" work, but this is probably worth documenting.
Could we also add documentation to the RBTools API docs about this new attribute?