<commit_before>from django.conf import settings
from django.conf.urls.defaults import *
from pressroom.models import *

try:
    MAKE_ARTICLE_OBJECT_LIST = settings.PRESSROOM_MAKE_ARTICLE_OBJECT_LIST
except:
    MAKE_ARTICLE_OBJECT_LIST = False

try:
    MAKE_DOCUMENT_OBJECT_LIST = settings.PRESSROOM_MAKE_DOCUMENT_OBJECT_LIST
except:
    MAKE_DOCUMENT_OBJECT_LIST = False

# custom views
urlpatterns = patterns('pressroom.views',
    url(r'^$', 'index', name="pr-index"),
    url(r'^section/(?P<slug>[\-\d\w]+)/$', 'view_section', name="pr-section"),
    url(r'^section/(?P<slug>[\-\d\w]+)/page/(?P<page>[0-9]+)/$', 'view_section', name="pr-section-page")
)

# articles
article_args = {'date_field': 'pub_date', 'allow_empty': True, 'queryset': Article.objects.get_published()}
if MAKE_ARTICLE_OBJECT_LIST:
    year_article_args = dict(article_args, make_object_list=True)
else:
    year_article_args = article_args

urlpatterns += patterns('django.views.generic.date_based',
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'date_field': 'pub_date', 'slug_field': 'slug', 'queryset': Article.objects.all()}, name='pr-article-detail'),
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', article_args, name='pr-article-archive-day'),
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', article_args, name='pr-article-archive-month'),
    url(r'^article/(?P<year>\d{4})/$', 'archive_year', year_article_args, name='pr-article-archive-year'),
    url(r'^article/$', 'archive_index', article_args, name='pr-article-archive'),
)
urlpatterns += patterns('django.views.generic.list_detail',
    url(r'^article/page/(?P<page>[0-9]+)/$', 'object_list', {'queryset': Article.objects.get_published(), 'allow_empty': True, 'paginate_by': 5}, name='pr-article-list'),
)

# documents
document_args = {'date_field': 'pub_date', 'allow_empty': True, 'queryset': Document.objects.all()}
if MAKE_ARTICLE_OBJECT_LIST:
    year_document_args = dict(document_args, make_object_list=True)
else:
    year_document_args = document_args
urlpatterns += patterns('django.views.generic.date_based',
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', dict(document_args, slug_field='slug'), name='pr-document-detail'),
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', document_args, name='pr-document-archive-day'),
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', document_args, name='pr-document-archive-month'),<commit_msg>patch to remove allow_empty from arguments to object_detail in documents, thanks to john.weaver<commit_after>from django.conf import settings
from django.conf.urls.defaults import *
from pressroom.models import *

try:
    MAKE_ARTICLE_OBJECT_LIST = settings.PRESSROOM_MAKE_ARTICLE_OBJECT_LIST
except:
    MAKE_ARTICLE_OBJECT_LIST = False

try:
    MAKE_DOCUMENT_OBJECT_LIST = settings.PRESSROOM_MAKE_DOCUMENT_OBJECT_LIST
except:
    MAKE_DOCUMENT_OBJECT_LIST = False

# custom views
urlpatterns = patterns('pressroom.views',
    url(r'^$', 'index', name="pr-index"),
    url(r'^section/(?P<slug>[\-\d\w]+)/$', 'view_section', name="pr-section"),
    url(r'^section/(?P<slug>[\-\d\w]+)/page/(?P<page>[0-9]+)/$', 'view_section', name="pr-section-page")
)

# articles
article_args = {'date_field': 'pub_date', 'allow_empty': True, 'queryset': Article.objects.get_published()}
if MAKE_ARTICLE_OBJECT_LIST:
    year_article_args = dict(article_args, make_object_list=True)
else:
    year_article_args = article_args

urlpatterns += patterns('django.views.generic.date_based',
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'date_field': 'pub_date', 'slug_field': 'slug', 'queryset': Article.objects.all()}, name='pr-article-detail'),
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', article_args, name='pr-article-archive-day'),
    url(r'^article/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', article_args, name='pr-article-archive-month'),
    url(r'^article/(?P<year>\d{4})/$', 'archive_year', year_article_args, name='pr-article-archive-year'),
    url(r'^article/$', 'archive_index', article_args, name='pr-article-archive'),
)
urlpatterns += patterns('django.views.generic.list_detail',
    url(r'^article/page/(?P<page>[0-9]+)/$', 'object_list', {'queryset': Article.objects.get_published(), 'allow_empty': True, 'paginate_by': 5}, name='pr-article-list'),
)

# documents
document_args = {'date_field': 'pub_date', 'allow_empty': True, 'queryset': Document.objects.all()}
if MAKE_ARTICLE_OBJECT_LIST:
    year_document_args = dict(document_args, make_object_list=True)
else:
    year_document_args = document_args
urlpatterns += patterns('django.views.generic.date_based',
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\-\d\w]+)/$', 'object_detail', {'date_field': 'pub_date', 'slug_field': 'slug', 'queryset': Document.objects.all()}, name='pr-document-detail'),
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', document_args, name='pr-document-archive-day'),
    url(r'^document/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', document_args, name='pr-document-archive-month'),
{'fraction_non_alphanumeric': 0.22909024211298606, 'fraction_numerical': 0.009537784299339692, 'mean_word_length': 6.573611111111111, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '6228014', 'n_tokens_mistral': 2098, 'n_tokens_neox': 2063, 'n_words': 255}