~fabricematrat/charmworld/redirect-charm

« back to all changes in this revision

Viewing changes to charmworld/views/charms.py

  • Committer: Fabrice Matrat
  • Date: 2015-02-09 08:50:44 UTC
  • Revision ID: fabricematrat@gmail.com-20150209085044-89z41t2zj22vhzn6
first redirect for charmworld to jujucharms.com

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import json
10
10
import os
11
11
import pymongo
 
12
from pyramid.httpexceptions import HTTPMovedPermanently
12
13
from pyramid.view import view_config
13
14
from webob import Response
14
15
 
315
316
    route_name="charm",
316
317
    renderer="charmworld:templates/charm.pt")
317
318
def distro_charm(request):
318
 
    _reconcile_revision(request)
319
 
    return _charm_view(request, find_charm(request, promulgated=True))
 
319
    redirect_url = request.registry.settings.get('redirect_jujucharms')
 
320
    raise HTTPMovedPermanently(
 
321
        location='{url}/{charm}/{series}'.
 
322
                  format(url = redirect_url,
 
323
                         charm=request.matchdict['charm'],
 
324
                         series=request.matchdict['series']))
320
325
 
321
326
 
322
327
@cached_view_config(