<commit_before>#:coding=utf8:

from django.conf.urls.defaults import patterns, url

from homepage.blog.feeds import (
    LatestEnglishBlogEntries,
    LatestJapaneseBlogEntries,
)

urlpatterns = patterns('django.views.generic.simple',
    # Old tag url redirect
    url(r'^(?P<locale>\w{2})/(?P<tag>[^/]+);$', 'redirect_to', {'url': '/%(locale)s/tag/%(tag)s'}, name='old_blog_tag_page'),
)

urlpatterns += patterns('homepage.blog.views',
    url(r'^admin/blog/post/(?P<object_id>[0-9]+)/preview$', 'blog_detail_preview', name='blog_detail_preview'),

    url(r'^(?P<locale>\w{2})/tag/(?P<tag>.+)$', 'tag_page', name='blog_tag_page'),
        
    url(r'^(?P<locale>\w{2})/(?P<slug>[^/]+)/?$', 'blog_detail', name='blog_detail'),
    url(r'^(?P<locale>\w{2})/?$', 'blog_page', name="blog_page"),
)

urlpatterns += patterns('',
    url(r'^feed/enfeed/$', LatestEnglishBlogEntries(), name='blog_feed_en'),
    url(r'^feed/enfeed/(?P<tag>.+)$', LatestEnglishBlogEntries(), name='blog_feed_en_tag'),
    url(r'^feed/jpfeed/$', LatestJapaneseBlogEntries(), name='blog_feed_jp'),
    url(r'^feed/jpfeed/(?P<tag>.+)$', LatestJapaneseBlogEntries(), name='blog_feed_jp_tag'),
)
<commit_msg>Only allow "en" or "jp" for the locale in the url.<commit_after>#:coding=utf8:

from django.conf.urls.defaults import patterns, url

from homepage.blog.feeds import (
    LatestEnglishBlogEntries,
    LatestJapaneseBlogEntries,
)

urlpatterns = patterns('django.views.generic.simple',
    # Old tag url redirect
    url(r'^(?P<locale>jp|en)/(?P<tag>[^/]+);$', 'redirect_to', {'url': '/%(locale)s/tag/%(tag)s'}, name='old_blog_tag_page'),
)

urlpatterns += patterns('homepage.blog.views',
    url(r'^admin/blog/post/(?P<object_id>[0-9]+)/preview$', 'blog_detail_preview', name='blog_detail_preview'),

    url(r'^(?P<locale>jp|en)/tag/(?P<tag>.+)$', 'tag_page', name='blog_tag_page'),
        
    url(r'^(?P<locale>jp|en)/(?P<slug>[^/]+)/?$', 'blog_detail', name='blog_detail'),
    url(r'^(?P<locale>jp|en)/?$', 'blog_page', name="blog_page"),
)

urlpatterns += patterns('',
    url(r'^feed/enfeed/$', LatestEnglishBlogEntries(), name='blog_feed_en'),
    url(r'^feed/enfeed/(?P<tag>.+)$', LatestEnglishBlogEntries(), name='blog_feed_en_tag'),
    url(r'^feed/jpfeed/$', LatestJapaneseBlogEntries(), name='blog_feed_jp'),
    url(r'^feed/jpfeed/(?P<tag>.+)$', LatestJapaneseBlogEntries(), name='blog_feed_jp_tag'),
)

{'fraction_non_alphanumeric': 0.23968320133388912, 'fraction_numerical': 0.004168403501458941, 'mean_word_length': 6.18562874251497, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7281028', 'n_tokens_mistral': 978, 'n_tokens_neox': 906, 'n_words': 110}