Пример #1
0
        mapping['diff'][verb] = wdiff.add
        mapping['layer'][verb] = wlayer.add
        mapping['notice'][verb] = wnotice.add
        mapping['preamble'][verb] = wdocument.add
        mapping['regulation'][verb] = wdocument.add


# Re-usable URL patterns.
def seg(label):
    return r'(?P<%s>[-\w]+)' % label


urlpatterns = patterns(
    '',
    by_verb_url(r'^diff/%s/%s/%s$' % (seg('label_id'), seg('old_version'),
                                      seg('new_version')),
                'diff', mapping['diff']),
    by_verb_url(r'^layer/{}/{}/{}$'.format(
        seg('name'), seg('doc_type'), r'(?P<doc_id>[-\w]+(/[-\w]+)*)'),
        'layer', mapping['layer']),
    by_verb_url(r'^notice/%s$' % seg('docnum'),
                'notice', mapping['notice']),
    by_verb_url(r'^regulation/%s/%s$' % (seg('label_id'), seg('version')),
                'regulation', mapping['regulation'],
                kwargs={'doc_type': 'cfr'}),
    by_verb_url(r'^notice$', 'notices', mapping['notices']),
    by_verb_url(r'^regulation$', 'all-reg-versions', mapping['reg-versions'],
                kwargs={'doc_type': 'cfr'}),
    by_verb_url(r'^regulation/%s$' % seg('label_id'),
                'reg-versions', mapping['reg-versions'],
                kwargs={'doc_type': 'cfr'}),
Пример #2
0
        mapping['regulation'][verb] = wdocument.add
    mapping['diff']['DELETE'] = wdiff.delete
    mapping['layer']['DELETE'] = wlayer.delete
    mapping['notice']['DELETE'] = wnotice.delete
    mapping['preamble']['DELETE'] = wdocument.delete
    mapping['regulation']['DELETE'] = wdocument.delete


# Re-usable URL patterns.
def seg(label):
    return r'(?P<%s>[-\w]+)' % label


urlpatterns = [
    by_verb_url(
        r'^diff/%s/%s/%s$' %
        (seg('label_id'), seg('old_version'), seg('new_version')), 'diff',
        mapping['diff']),
    by_verb_url(
        r'^layer/{}/{}/{}$'.format(seg('name'), seg('doc_type'),
                                   r'(?P<doc_id>[-\w]+(/[-\w]+)*)'), 'layer',
        mapping['layer']),
    by_verb_url(r'^notice/%s$' % seg('docnum'), 'notice', mapping['notice']),
    by_verb_url(r'^regulation/%s/%s$' % (seg('label_id'), seg('version')),
                'regulation',
                mapping['regulation'],
                kwargs={'doc_type': 'cfr'}),
    by_verb_url(r'^notice$', 'notices', mapping['notices']),
    by_verb_url(r'^regulation$',
                'all-reg-versions',
                mapping['reg-versions'],
                kwargs={'doc_type': 'cfr'}),
Пример #3
0
    for verb in ('PUT', 'POST'):
        mapping['diff'][verb] = wdiff.add
        mapping['layer'][verb] = wlayer.add
        mapping['notice'][verb] = wnotice.add
        mapping['regulation'][verb] = wregulation.add


# Re-usable URL patterns.
def seg(label):
    return r'(?P<%s>[-\d\w]+)' % label


urlpatterns = patterns(
    '',
    by_verb_url(r'^diff/%s/%s/%s$' % (seg('label_id'), seg('old_version'),
                                      seg('new_version')),
                'diff', mapping['diff']),
    by_verb_url(r'^layer/%s/%s/%s$' % (seg('name'), seg('label_id'),
                                       seg('version')),
                'layer', mapping['layer']),
    by_verb_url(r'^notice/%s$' % seg('docnum'),
                'notice', mapping['notice']),
    by_verb_url(r'^regulation/%s/%s$' % (seg('label_id'), seg('version')),
                'regulation', mapping['regulation']),
    by_verb_url(r'^notice$', 'notices', mapping['notices']),
    by_verb_url(r'^regulation$', 'all-reg-versions', mapping['reg-versions']),
    by_verb_url(r'^regulation/%s$' % seg('label_id'),
                'reg-versions', mapping['reg-versions']),
    by_verb_url(r'^search$', 'search', mapping['search'])
)
Пример #4
0
    # Allow both PUT and POST
    for verb in ('PUT', 'POST'):
        mapping['diff'][verb] = wdiff.add
        mapping['layer'][verb] = wlayer.add
        mapping['notice'][verb] = wnotice.add
        mapping['regulation'][verb] = wregulation.add


# Re-usable URL patterns.
def seg(label):
    return r'(?P<%s>[-\d\w]+)' % label


urlpatterns = patterns(
    '',
    by_verb_url(
        r'^diff/%s/%s/%s$' %
        (seg('label_id'), seg('old_version'), seg('new_version')), 'diff',
        mapping['diff']),
    by_verb_url(
        r'^layer/%s/%s/%s$' % (seg('name'), seg('label_id'), seg('version')),
        'layer', mapping['layer']),
    by_verb_url(r'^notice/%s$' % seg('docnum'), 'notice', mapping['notice']),
    by_verb_url(r'^regulation/%s/%s$' % (seg('label_id'), seg('version')),
                'regulation', mapping['regulation']),
    by_verb_url(r'^notice$', 'notices', mapping['notices']),
    by_verb_url(r'^regulation$', 'all-reg-versions', mapping['reg-versions']),
    by_verb_url(r'^regulation/%s$' % seg('label_id'), 'reg-versions',
                mapping['reg-versions']),
    by_verb_url(r'^search$', 'search', mapping['search']))