~nataliabidart/ubuntu-sso-client/all-ui-from-code

« back to all changes in this revision

Viewing changes to ubuntu_sso/utils/ui.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2012-02-13 17:32:01 UTC
  • mfrom: (861.2.1 ui-command-line-params)
  • Revision ID: tarmac-20120213173201-2702krtkqoa5qvbq
- Unified UI parse_args and have them accepting a policy_url param
  (LP: #931464).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# with this program.  If not, see <http://www.gnu.org/licenses/>.
16
16
"""Utils to be used by the UI modules."""
17
17
 
 
18
import argparse
18
19
import re
19
20
import gettext
20
21
 
184
185
def is_correct_email(email_address):
185
186
    """Return if the email is correct."""
186
187
    return '@' in email_address
 
188
 
 
189
 
 
190
def parse_args():
 
191
    """Parse sys.argv options."""
 
192
    parser = argparse.ArgumentParser(description='Open the SSO UI.')
 
193
    parser.add_argument('--app_name', required=True,
 
194
        help='the name of the application to retrieve credentials for')
 
195
    parser.add_argument('--ping_url', default='',
 
196
        help='a link to be used as the ping url (to notify about new tokens)')
 
197
    parser.add_argument('--policy_url', default='',
 
198
        help='a link to be used as Privacy Policy url')
 
199
    parser.add_argument('--tc_url', default='',
 
200
        help='a link to be used as Terms & Conditions url')
 
201
    parser.add_argument('--help_text', default='',
 
202
        help='extra text that will be shown below the headers')
 
203
    parser.add_argument('--window_id', type=int, default=0,
 
204
        help='the window id to be set transient for the SSO dialogs')
 
205
    parser.add_argument('--login_only', action='store_true', default=False,
 
206
        help='whether the SSO UI should only offer login or not')
 
207
 
 
208
    args = parser.parse_args()
 
209
    return args