<s> from __future__ import unicode_literals <EOL> import logging <EOL> from django import forms <EOL> from django . utils import six <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from reviewboard . hostingsvcs . bugtracker import BugTracker <EOL> from reviewboard . hostingsvcs . forms import HostingServiceForm <EOL> from reviewboard . hostingsvcs . service import HostingService <EOL> from reviewboard . admin . validation import validate_bug_tracker_base_hosting_url <EOL> class BugzillaForm ( HostingServiceForm ) : <EOL> bugzilla_url = forms . CharField ( <EOL> label = _ ( '<STR_LIT>' ) , <EOL> max_length = <NUM_LIT:64> , <EOL> required = True , <EOL> widget = forms . TextInput ( attrs = { '<STR_LIT:size>' : '<STR_LIT>' } ) , <EOL> validators = [ validate_bug_tracker_base_hosting_url ] ) <EOL> def clean_bugzilla_url ( self ) : <EOL> return self . cleaned_data [ '<STR_LIT>' ] . rstrip ( '<STR_LIT:/>' ) <EOL> class Bugzilla ( HostingService , BugTracker ) : <EOL> name = '<STR_LIT>' <EOL> form = BugzillaForm <EOL> bug_tracker_field = '<STR_LIT>' <EOL> supports_bug_trackers = True <EOL> def get_bug_info_uncached ( self , repository , bug_id ) : <EOL> """<STR_LIT>""" <EOL> bug_id = six . text_type ( bug_id ) <EOL> result = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> } <EOL> try : <EOL> url = '<STR_LIT>' % ( <EOL> repository . extra_data [ '<STR_LIT>' ] , <EOL> bug_id ) <EOL> rsp , headers = self . client . json_get ( url ) <EOL> result [ '<STR_LIT>' ] = rsp [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , <EOL> result [ '<STR_LIT:status>' ] = rsp [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT:status>' ] , <EOL> except Exception as e : <EOL> logging . warning ( '<STR_LIT>' , <EOL> url , e , exc_info = <NUM_LIT:1> ) <EOL> try : <EOL> url += '<STR_LIT>' <EOL> rsp , headers = self . client . json_get ( url ) <EOL> result [ '<STR_LIT:description>' ] = rsp [ '<STR_LIT>' ] [ bug_id ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT:text>' ] <EOL> except Exception as e : <EOL> logging . warning ( '<STR_LIT>' , <EOL> url , e , exc_info = <NUM_LIT:1> ) <EOL> return result </s>
