Skip to content

fix bug 759356 - update devmo_url for kuma #269

Merged
merged 2 commits into from Jun 14, 2012

2 participants

@groovecoder
Mozilla member

need someone to review:

  • have to manually migrate translated version of pages
  • caching the url's to avoid a hundred queries per page
  • devmo_url can't automatically follow re-directs without refactoring redirect_url
@lmorchard lmorchard commented on an outdated diff Jun 13, 2012
templates/base.html
@@ -169,10 +169,10 @@ <h1 id="logo"><a href="{{ url('home') }}"><img src="{{ MEDIA_URL }}img/mdn-logo-
<img src="{{ MEDIA_URL }}img/mdn-logo-tiny.png" alt="" width="42" height="48">
<p id="copyright">&copy; {{ thisyear() }} Mozilla Developer Network</p>
<p>
- {% trans copyright_url=devmo_url(_('/Project:Copyrights')) %}
+ {% trans copyright_url=devmo_url('/Project:Copyrights') %}
@lmorchard
Mozilla member
lmorchard added a note Jun 13, 2012

This looks like it should be Project:Copyrights - no leading '/'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lmorchard lmorchard commented on an outdated diff Jun 13, 2012
templates/base.html
Content is available under <a href="{{ copyright_url }}">these licenses</a>
{% endtrans %}
- &bull; <a href="{{ devmo_url(_('/Project:en/About')) }}">{{ _('About MDN') }}</a> &bull;
+ &bull; <a href="{{ devmo_url('/Project:en/About') }}">{{ _('About MDN') }}</a> &bull;
@lmorchard
Mozilla member
lmorchard added a note Jun 13, 2012

This looks like it should be Project:About - no leading '/' or en in the slug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lmorchard lmorchard commented on an outdated diff Jun 13, 2012
apps/devmo/helpers.py
"""
if not settings.DEKIWIKI_ENDPOINT:
- # HACK: If MindTouch is unavailable, skip the rest of this and lean on
- # locale processing redirects to resolve things. Might be interesting
- # to resolve some of the redirects first, and come up with the ultimate
- # real URL. See bug 759356 for followup.
- path = path.replace('/en', '')
- return '/%s/docs%s' % (context['request'].locale, path)
+ locale = context['request'].locale
+ url = cache.get('devmo_url:%s_%s' % (locale, path))
+ if not url:
+ url = reverse('wiki.document',
+ locale=settings.WIKI_DEFAULT_LANGUAGE,
+ args=[path])
+ if locale != settings.WIKI_DEFAULT_LANGUAGE:
+ try:
@lmorchard
Mozilla member
lmorchard added a note Jun 13, 2012

One too many levels of indentation in this try / except block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lmorchard
Mozilla member

Beyond nits found in eyeballing the code, tests pass, and it seems to work in a manual check.

@groovecoder
Mozilla member

nits fixed + code cleanup. verify tests still pass?

@lmorchard
Mozilla member

Tests pass, seems like it works for me

@lmorchard lmorchard merged commit 824118b into mozilla:master Jun 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.