Re: RBTools Ticket #5001: Please add detailed information about reviewboard URL to rbt login

21 views
Skip to first unread message

Shubha Ramani

unread,
Jan 16, 2024, 5:21:57 PM1/16/24
to Shubha Ramani, reviewboa...@googlegroups.com
To reply, visit https://hellosplat.com/s/beanbag/tickets/5001/

New update by shubhar

For Beanbag, Inc. RBTools Ticket #5001

Has anything been done on this ? If not, I am willing to work on it and try to deliver a patch.

Shubha Ramani

unread,
Jan 18, 2024, 1:24:19 PM1/18/24
to reviewboard-issues
has any attempts been made to fix this one ? 

David Trowbridge

unread,
Jan 18, 2024, 1:28:17 PM1/18/24
to David Trowbridge, Shubha Ramani, reviewboa...@googlegroups.com

New update by david

To my knowledge, there has been no work on this. We'd love a contribution!

Thanks

Shubha Ramani

unread,
Feb 6, 2024, 4:39:00 PM2/6/24
to reviewboard-issues
For rbtools-3.1.1 I am recommending the below minor changes. Any comments ?

I think server_url is what we need:
https://github.com/reviewboard/rbtools/blob/release-3.x/rbtools/commands/__init__.py#L336 

To fix this, I believe I need server_url, which is initialized here :
 https://github.com/reviewboard/rbtools/blob/release-3.x/rbtools/commands/__init__.py#L1007 

 

Then change this line in login.py:
https://github.com/reviewboard/rbtools/blob/release-3.x/rbtools/commands/login.py#L47 
 

To:
logging.info('Successfully logged in to Review Board at %s', self.server_url)

And change this line in login.py to:
https://github.com/reviewboard/rbtools/blob/release-3.x/rbtools/commands/login.py#L49 
logging.info('You are already logged in to Review Board at %s',
                             self.server_url)

David Trowbridge

unread,
Feb 6, 2024, 7:28:55 PM2/6/24
to reviewboa...@googlegroups.com
Referring to line numbers via email is not the right way to do code review. Please post your change on https://reviews.reviewboard.org/

David

--
You received this message because you are subscribed to the Google Groups "reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard-iss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard-issues/ecc45949-891a-4f71-876d-0def8a1d1439n%40googlegroups.com.

Shubha Ramani

unread,
Feb 6, 2024, 7:38:10 PM2/6/24
to reviewboa...@googlegroups.com
sorry David. Will do

Shubha 

From: reviewboa...@googlegroups.com <reviewboa...@googlegroups.com> on behalf of David Trowbridge <trow...@gmail.com>
Sent: Tuesday, February 6, 2024 4:28:42 PM
To: reviewboa...@googlegroups.com <reviewboa...@googlegroups.com>
Subject: Re: RBTools Ticket #5001: Please add detailed information about reviewboard URL to rbt login
 
You received this message because you are subscribed to a topic in the Google Groups "reviewboard-issues" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reviewboard-issues/RxdDYM-6oaE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reviewboard-iss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard-issues/CAFS3VNXFSJbH0ZPjgg9YR%3DbME6XDdYffLy2097ub7%2BjEpe92Ag%40mail.gmail.com.

Shubha Ramani

unread,
Feb 12, 2024, 10:48:10 AM2/12/24
to Shubha Ramani, reviewboa...@googlegroups.com

New update by shubhar

I'm not going to submit a patch for this. But here is the fix. It's super easy. I hope you roll it into 4.1 too. change rbtools_install/rbtools/commands/login.py as follows (use self.server_url instead of self.api_client.domain)

 """Run the command."""
    session = self.api_root.get_session(expand='user')
    was_authenticated = session.authenticated

    if not was_authenticated:
        try:
            session = get_authenticated_session(api_client=self.api_client,
                                                api_root=self.api_root,
                                                auth_required=True,
                                                session=session)
        except AuthorizationError:
            raise CommandError('Unable to log in to Review Board.')

    if session.authenticated:
        if not was_authenticated or (self.options.username and
                                     self.options.password):
            logging.info('Successfully logged in to Review Board at %s', self.server_url)
        else:
            

Shubha Ramani

unread,
Feb 13, 2024, 9:02:10 AM2/13/24
to Shubha Ramani, reviewboa...@googlegroups.com

New update by shubhar

For Beanbag, Inc. RBTools Ticket #5001

an alternative method: root = self.api_client.get_root() #pdb.set_trace() rb_url = root.transport.url if not was_authenticated: try: session = get_authenticated_session(api_client=self.api_client, api_root=self.api_root, auth_required=True, session=session) except AuthorizationError: raise CommandError('Unable to log in to Review Board at %s', rb

    if session.authenticated:
        if not was_authenticated or (self.options.username and
                                     self.options.password):
            logging.info('Successfully logged in to Review Board at %s', rb_
        else:
            logging.info('You are already logged in to Review Board at %s',
                         rb_url
            )

Shubha Ramani

unread,
Feb 13, 2024, 9:07:49 AM2/13/24
to Shubha Ramani, reviewboa...@googlegroups.com
David I'm flummoxed. I've tested this fix locally and it works fine. I've made sure to rm -rf  __pycache__  within the system wide rbtools installation (I had our sysadmin guy do it). Yet it still behaves like the old version ! I've modified login.py with the changes, had the system admin guy drop and replace the modified login.py into    
rbtools-3.1.1/rbtools/commands/login.py  and the changes don't take effect. This despite the fact that I actually SEE the changed login.py in  rbtools-3.1.1/rbtools/commands/

The rbtools is installed in a central location which except for the sys admin guy, is read only for all. I git cloned a local version and tested it - worked fine.

Hope you can advise me.

Shubha

Shubha Ramani

unread,
Feb 13, 2024, 12:00:50 PM2/13/24
to Shubha Ramani, reviewboa...@googlegroups.com
figured it out. It was PYTHONPATH. Just do export PYTHONPATH=<top level directory where rbtools is installed>:$PYTHONPATH.


Shubha Ramani

unread,
Feb 13, 2024, 12:13:55 PM2/13/24
to Shubha Ramani, reviewboa...@googlegroups.com

New update by shubhar

For Beanbag, Inc. RBTools Ticket #5001

Sorry looks like part of the previous post got truncated. Here's the full login.py from future import unicode_literals

import logging

from rbtools.api.errors import AuthorizationError from rbtools.commands import Command, CommandError from rbtools.utils.users import get_authenticated_session

import pdb

class Login(Command): """Logs into a Review Board server.

The user will be prompted for a username and password, unless otherwise
passed on the command line, allowing the user to log in and save a
session cookie without needing to be in a repository or posting to
the server.

If the user is already logged in, this won't do anything.
"""

name = 'login'
author = 'The Review Board Project'

needs_api = True

option_list = [
    Command.server_options,
]

def main(self):
    """Run the command."""
    session = self.api_root.get_session(expand='user')
    was_authenticated = session.authenticated
    root = self.api_client.get_root()
    #pdb.set_trace()
    rb_url = root._transport.url
    if not was_authenticated:
        try:
            session = get_authenticated_session(api_client=self.api_client,
                                                api_root=self.api_root,
                                                auth_required=True,
                                                session=session)
        except AuthorizationError:
            raise CommandError('Unable to log in to Review Board at %s', rb_url)

    if session.authenticated:
        if not was_authenticated or (self.options.username and
                                     self.options.password):
            logging.info('Successfully logged in to Review Board at %s', rb_url)
        else:
            

Reply all
Reply to author
Forward
0 new messages