<s> from django . conf . urls import include , patterns , url <EOL> from django . db . transaction import non_atomic_requests <EOL> from olympia . addons . urls import ADDON_ID <EOL> from olympia . legacy_api import views <EOL> @ non_atomic_requests <EOL> def api_view ( cls ) : <EOL> return lambda * args , ** kw : cls ( ) ( * args , ** kw ) <EOL> def build_urls ( base , appendages ) : <EOL> """<STR_LIT>""" <EOL> urls = [ base ] <EOL> for i in range ( len ( appendages ) ) : <EOL> urls . append ( base + '<STR_LIT>' . join ( appendages [ : i + <NUM_LIT:1> ] ) ) <EOL> return urls <EOL> base_search_regexp = r'<STR_LIT>' <EOL> appendages = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> search_regexps = build_urls ( base_search_regexp , appendages ) <EOL> appendages . insert ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> list_regexps = build_urls ( r'<STR_LIT:list>' , appendages ) <EOL> legacy_api_patterns = patterns ( <EOL> '<STR_LIT>' , <EOL> url ( '<STR_LIT>' % ADDON_ID , api_view ( views . AddonDetailView ) , <EOL> name = '<STR_LIT>' ) , <EOL> url ( r'<STR_LIT>' , api_view ( views . LanguageView ) , <EOL> name = '<STR_LIT>' ) , ) <EOL> for regexp in search_regexps : <EOL> legacy_api_patterns += patterns ( <EOL> '<STR_LIT>' , <EOL> url ( regexp + '<STR_LIT>' , api_view ( views . SearchView ) , <EOL> name = '<STR_LIT>' ) ) <EOL> for regexp in list_regexps : <EOL> legacy_api_patterns += patterns ( <EOL> '<STR_LIT>' , <EOL> url ( regexp + '<STR_LIT>' , api_view ( views . ListView ) , <EOL> name = '<STR_LIT>' ) ) <EOL> urlpatterns = patterns ( <EOL> '<STR_LIT>' , <EOL> url ( '<STR_LIT>' , views . redirect_view ) , <EOL> url ( r'<STR_LIT>' , views . search_suggestions ) , <EOL> url ( r'<STR_LIT>' , <EOL> views . guid_search ) , <EOL> url ( r'<STR_LIT>' , include ( legacy_api_patterns ) ) , <EOL> ) </s>
