diff --git a/spirit/category/admin/urls.py b/spirit/category/admin/urls.py index 06b619c0..e7f04174 100644 --- a/spirit/category/admin/urls.py +++ b/spirit/category/admin/urls.py @@ -10,5 +10,5 @@ from . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^create/$', views.create, name='create'), - url(r'^update/(?P\d+)/$', views.update, name='update'), + url(r'^update/(?P[0-9]+)/$', views.update, name='update'), ] diff --git a/spirit/category/urls.py b/spirit/category/urls.py index a35fa585..42260fb1 100644 --- a/spirit/category/urls.py +++ b/spirit/category/urls.py @@ -10,6 +10,6 @@ from . import views urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^(?P\d+)/$', views.detail, kwargs={'slug': "", }, name='detail'), - url(r'^(?P\d+)/(?P[\w-]+)/$', views.detail, name='detail'), -] \ No newline at end of file + url(r'^(?P[0-9]+)/$', views.detail, kwargs={'slug': "", }, name='detail'), + url(r'^(?P[0-9]+)/(?P[\w-]+)/$', views.detail, name='detail'), +] diff --git a/spirit/comment/bookmark/urls.py b/spirit/comment/bookmark/urls.py index 50ab4472..2242a0c0 100644 --- a/spirit/comment/bookmark/urls.py +++ b/spirit/comment/bookmark/urls.py @@ -8,6 +8,6 @@ from . import views urlpatterns = [ - url(r'^(?P\d+)/create/$', views.create, name='create'), - url(r'^(?P\d+)/find/$', views.find, name='find'), + url(r'^(?P[0-9]+)/create/$', views.create, name='create'), + url(r'^(?P[0-9]+)/find/$', views.find, name='find'), ] diff --git a/spirit/comment/flag/admin/urls.py b/spirit/comment/flag/admin/urls.py index b03ba997..2524f594 100644 --- a/spirit/comment/flag/admin/urls.py +++ b/spirit/comment/flag/admin/urls.py @@ -11,5 +11,5 @@ urlpatterns = [ url(r'^$', views.opened, name='index'), url(r'^opened/$', views.opened, name='opened'), url(r'^closed/$', views.closed, name='closed'), - url(r'^(?P\d+)/$', views.detail, name='detail'), + url(r'^(?P[0-9]+)/$', views.detail, name='detail'), ] diff --git a/spirit/comment/flag/urls.py b/spirit/comment/flag/urls.py index d64dc6dd..1f066e49 100644 --- a/spirit/comment/flag/urls.py +++ b/spirit/comment/flag/urls.py @@ -8,5 +8,5 @@ from . import views urlpatterns = [ - url(r'^(?P\d+)/create/$', views.create, name='create'), + url(r'^(?P[0-9]+)/create/$', views.create, name='create'), ] diff --git a/spirit/comment/forms.py b/spirit/comment/forms.py index efe60cac..f05f5775 100644 --- a/spirit/comment/forms.py +++ b/spirit/comment/forms.py @@ -27,10 +27,10 @@ except ImportError as err: # There used to be a logger.exception here but # the traceback made things confusing when an unhandled was raised if settings.ST_UPLOAD_FILE_ENABLED: - logger.warning( - 'Can\'t load python-magic. ' - 'Is libmagic installed?') - logger.error(err) + logger.info( + 'File upload requires running: ' + '`pip install django-spirit[files]`') + raise err magic = None diff --git a/spirit/comment/history/urls.py b/spirit/comment/history/urls.py index 66c4c4a9..156af886 100644 --- a/spirit/comment/history/urls.py +++ b/spirit/comment/history/urls.py @@ -8,5 +8,5 @@ from . import views urlpatterns = [ - url(r'^(?P\d+)/$', views.detail, name='detail'), + url(r'^(?P[0-9]+)/$', views.detail, name='detail'), ] diff --git a/spirit/comment/like/urls.py b/spirit/comment/like/urls.py index b801140a..0097683d 100644 --- a/spirit/comment/like/urls.py +++ b/spirit/comment/like/urls.py @@ -8,6 +8,6 @@ from . import views urlpatterns = [ - url(r'^(?P\d+)/create/$', views.create, name='create'), - url(r'^(?P\d+)/delete/$', views.delete, name='delete'), + url(r'^(?P[0-9]+)/create/$', views.create, name='create'), + url(r'^(?P[0-9]+)/delete/$', views.delete, name='delete'), ] diff --git a/spirit/comment/poll/urls.py b/spirit/comment/poll/urls.py index 9d168887..e7f5d559 100644 --- a/spirit/comment/poll/urls.py +++ b/spirit/comment/poll/urls.py @@ -8,8 +8,8 @@ from . import views urlpatterns = [ - url(r'^close/(?P\d+)/$', views.close_or_open, name='close'), - url(r'^open/(?P\d+)/$', views.close_or_open, kwargs={'close': False}, name='open'), - url(r'^vote/(?P\d+)/$', views.vote, name='vote'), - url(r'^voters/(?P\d+)/$', views.voters, name='voters'), + url(r'^close/(?P[0-9]+)/$', views.close_or_open, name='close'), + url(r'^open/(?P[0-9]+)/$', views.close_or_open, kwargs={'close': False}, name='open'), + url(r'^vote/(?P[0-9]+)/$', views.vote, name='vote'), + url(r'^voters/(?P[0-9]+)/$', views.voters, name='voters'), ] diff --git a/spirit/comment/urls.py b/spirit/comment/urls.py index b8ab1bb6..62b0d923 100644 --- a/spirit/comment/urls.py +++ b/spirit/comment/urls.py @@ -14,15 +14,15 @@ from . import views urlpatterns = [ - url(r'^(?P\d+)/publish/$', views.publish, name='publish'), - url(r'^(?P\d+)/publish/(?P\d+)/quote/$', views.publish, name='publish'), + url(r'^(?P[0-9]+)/publish/$', views.publish, name='publish'), + url(r'^(?P[0-9]+)/publish/(?P[0-9]+)/quote/$', views.publish, name='publish'), - url(r'^(?P\d+)/update/$', views.update, name='update'), - url(r'^(?P\d+)/find/$', views.find, name='find'), - url(r'^(?P\d+)/move/$', views.move, name='move'), + url(r'^(?P[0-9]+)/update/$', views.update, name='update'), + url(r'^(?P[0-9]+)/find/$', views.find, name='find'), + url(r'^(?P[0-9]+)/move/$', views.move, name='move'), - url(r'^(?P\d+)/delete/$', views.delete, name='delete'), - url(r'^(?P\d+)/undelete/$', views.delete, kwargs={'remove': False, }, name='undelete'), + url(r'^(?P[0-9]+)/delete/$', views.delete, name='delete'), + url(r'^(?P[0-9]+)/undelete/$', views.delete, kwargs={'remove': False, }, name='undelete'), url(r'^bookmark/', include(spirit.comment.bookmark.urls, namespace='bookmark')), url(r'^flag/', include(spirit.comment.flag.urls, namespace='flag')), diff --git a/spirit/core/utils/markdown/block.py b/spirit/core/utils/markdown/block.py index c3f8681f..77ef211a 100644 --- a/spirit/core/utils/markdown/block.py +++ b/spirit/core/utils/markdown/block.py @@ -59,9 +59,9 @@ class BlockGrammar(mistune.BlockGrammar): r'vimeo\.com/' r'(?:channels/' r'|groups/[^/]+/videos/' - r'|album/(?:\d+)/video/' + r'|album/(?:[0-9]+)/video/' r'|video/)?' - r'(?P\d+)' + r'(?P[0-9]+)' r'(?:\?[^\s]+)?' r'(?:\n+|$)' r')|' @@ -105,14 +105,14 @@ class BlockGrammar(mistune.BlockGrammar): poll = re.compile( r'^(?:\[poll' r'((?:\s+name=(?P[\w\-_]+))' - r'(?:\s+min=(?P\d+))?' - r'(?:\s+max=(?P\d+))?' - r'(?:\s+close=(?P\d+)d)?' + r'(?:\s+min=(?P[0-9]+))?' + r'(?:\s+max=(?P[0-9]+))?' + r'(?:\s+close=(?P[0-9]+)d)?' r'(?:\s+mode=(?P(default|secret)))?' r'|(?P[^\]]*))' r'\])\n' r'((?:#\s*(?P[^\n]+\n))?' - r'(?P<choices>(?:\d+\.\s*[^\n]+\n){2,})' + r'(?P<choices>(?:[0-9]+\.\s*[^\n]+\n){2,})' r'|(?P<invalid_body>(?:[^\n]+\n)*))' r'(?:\[/poll\])' ) diff --git a/spirit/core/utils/markdown/utils/quote.py b/spirit/core/utils/markdown/utils/quote.py index e438b1cb..b7de3c19 100644 --- a/spirit/core/utils/markdown/utils/quote.py +++ b/spirit/core/utils/markdown/utils/quote.py @@ -11,7 +11,7 @@ from ....conf import settings _PATTERN_POLL = re.compile( r'^(?:\[poll[^\]]*\])\n+' - r'(?:\d+[^\n]*\n+)+' + r'(?:[0-9]+[^\n]*\n+)+' r'(?:\[/poll\])', flags=re.MULTILINE ) diff --git a/spirit/topic/favorite/urls.py b/spirit/topic/favorite/urls.py index 6ae6cca1..22034974 100644 --- a/spirit/topic/favorite/urls.py +++ b/spirit/topic/favorite/urls.py @@ -8,6 +8,6 @@ from . import views urlpatterns = [ - url(r'^(?P<topic_id>\d+)/create/$', views.create, name='create'), - url(r'^(?P<pk>\d+)/delete/$', views.delete, name='delete'), + url(r'^(?P<topic_id>[0-9]+)/create/$', views.create, name='create'), + url(r'^(?P<pk>[0-9]+)/delete/$', views.delete, name='delete'), ] diff --git a/spirit/topic/moderate/urls.py b/spirit/topic/moderate/urls.py index 264b12d5..81259d1c 100644 --- a/spirit/topic/moderate/urls.py +++ b/spirit/topic/moderate/urls.py @@ -8,15 +8,15 @@ from . import views urlpatterns = [ - url(r'^delete/(?P<pk>\d+)/$', views.delete, name='delete'), - url(r'^undelete/(?P<pk>\d+)/$', views.undelete, name='undelete'), + url(r'^delete/(?P<pk>[0-9]+)/$', views.delete, name='delete'), + url(r'^undelete/(?P<pk>[0-9]+)/$', views.undelete, name='undelete'), - url(r'^lock/(?P<pk>\d+)/$', views.lock, name='lock'), - url(r'^unlock/(?P<pk>\d+)/$', views.unlock, name='unlock'), + url(r'^lock/(?P<pk>[0-9]+)/$', views.lock, name='lock'), + url(r'^unlock/(?P<pk>[0-9]+)/$', views.unlock, name='unlock'), - url(r'^pin/(?P<pk>\d+)/$', views.pin, name='pin'), - url(r'^unpin/(?P<pk>\d+)/$', views.unpin, name='unpin'), + url(r'^pin/(?P<pk>[0-9]+)/$', views.pin, name='pin'), + url(r'^unpin/(?P<pk>[0-9]+)/$', views.unpin, name='unpin'), - url(r'^global-pin/(?P<pk>\d+)/$', views.global_pin, name='global-pin'), - url(r'^global-unpin/(?P<pk>\d+)/$', views.global_unpin, name='global-unpin'), + url(r'^global-pin/(?P<pk>[0-9]+)/$', views.global_pin, name='global-pin'), + url(r'^global-unpin/(?P<pk>[0-9]+)/$', views.global_unpin, name='global-unpin'), ] diff --git a/spirit/topic/notification/urls.py b/spirit/topic/notification/urls.py index 243e1b66..4e4132aa 100644 --- a/spirit/topic/notification/urls.py +++ b/spirit/topic/notification/urls.py @@ -11,6 +11,6 @@ urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^unread/$', views.index_unread, name='index-unread'), url(r'^ajax/$', views.index_ajax, name='index-ajax'), - url(r'^(?P<topic_id>\d+)/create/$', views.create, name='create'), - url(r'^(?P<pk>\d+)/update/$', views.update, name='update'), + url(r'^(?P<topic_id>[0-9]+)/create/$', views.create, name='create'), + url(r'^(?P<pk>[0-9]+)/update/$', views.update, name='update'), ] diff --git a/spirit/topic/private/urls.py b/spirit/topic/private/urls.py index b8c8b9d8..4c3208ec 100644 --- a/spirit/topic/private/urls.py +++ b/spirit/topic/private/urls.py @@ -12,12 +12,12 @@ urlpatterns = [ url(r'^author/$', views.index_author, name='index-author'), url(r'^publish/$', views.publish, name='publish'), - url(r'^publish/(?P<user_id>\d+)/$', views.publish, name='publish'), + url(r'^publish/(?P<user_id>[0-9]+)/$', views.publish, name='publish'), - url(r'^(?P<topic_id>\d+)/$', views.detail, kwargs={'slug': "", }, name='detail'), - url(r'^(?P<topic_id>\d+)/(?P<slug>[\w-]+)/$', views.detail, name='detail'), + url(r'^(?P<topic_id>[0-9]+)/$', views.detail, kwargs={'slug': "", }, name='detail'), + url(r'^(?P<topic_id>[0-9]+)/(?P<slug>[\w-]+)/$', views.detail, name='detail'), - url(r'^invite/(?P<topic_id>\d+)/$', views.create_access, name='access-create'), - url(r'^remove/(?P<pk>\d+)/$', views.delete_access, name='access-remove'), - url(r'^join/(?P<topic_id>\d+)/$', views.join_in, name='join'), + url(r'^invite/(?P<topic_id>[0-9]+)/$', views.create_access, name='access-create'), + url(r'^remove/(?P<pk>[0-9]+)/$', views.delete_access, name='access-remove'), + url(r'^join/(?P<topic_id>[0-9]+)/$', views.join_in, name='join'), ] diff --git a/spirit/topic/urls.py b/spirit/topic/urls.py index e59e9c41..3189daaa 100644 --- a/spirit/topic/urls.py +++ b/spirit/topic/urls.py @@ -14,12 +14,12 @@ from . import views urlpatterns = [ url(r'^publish/$', views.publish, name='publish'), - url(r'^publish/(?P<category_id>\d+)/$', views.publish, name='publish'), + url(r'^publish/(?P<category_id>[0-9]+)/$', views.publish, name='publish'), - url(r'^update/(?P<pk>\d+)/$', views.update, name='update'), + url(r'^update/(?P<pk>[0-9]+)/$', views.update, name='update'), - url(r'^(?P<pk>\d+)/$', views.detail, kwargs={'slug': "", }, name='detail'), - url(r'^(?P<pk>\d+)/(?P<slug>[\w-]+)/$', views.detail, name='detail'), + url(r'^(?P<pk>[0-9]+)/$', views.detail, kwargs={'slug': "", }, name='detail'), + url(r'^(?P<pk>[0-9]+)/(?P<slug>[\w-]+)/$', views.detail, name='detail'), url(r'^active/$', views.index_active, name='index-active'), diff --git a/spirit/user/admin/urls.py b/spirit/user/admin/urls.py index 1647aa8b..c725c3d2 100644 --- a/spirit/user/admin/urls.py +++ b/spirit/user/admin/urls.py @@ -12,5 +12,5 @@ urlpatterns = [ url(r'^admins/$', views.index_admins, name='index-admins'), url(r'^mods/$', views.index_mods, name='index-mods'), url(r'^unactive/$', views.index_unactive, name='index-unactive'), - url(r'^edit/(?P<user_id>\d+)/$', views.edit, name='edit'), + url(r'^edit/(?P<user_id>[0-9]+)/$', views.edit, name='edit'), ] diff --git a/spirit/user/auth/urls.py b/spirit/user/auth/urls.py index 3e3e9725..860a34f0 100644 --- a/spirit/user/auth/urls.py +++ b/spirit/user/auth/urls.py @@ -16,7 +16,7 @@ urlpatterns = [ url(r'^register/$', views.register, name='register'), url(r'^resend-activation/$', views.resend_activation_email, name='resend-activation'), - url(r'^activation/(?P<pk>\d+)/(?P<token>[0-9A-Za-z_\-\.]+)/$', views.registration_activation, + url(r'^activation/(?P<pk>[0-9]+)/(?P<token>[0-9A-Za-z_\-\.]+)/$', views.registration_activation, name='registration-activation'), url(r'^password-reset/$', views.custom_password_reset, { diff --git a/spirit/user/urls.py b/spirit/user/urls.py index 1c856a37..c2ee1427 100644 --- a/spirit/user/urls.py +++ b/spirit/user/urls.py @@ -14,16 +14,16 @@ urlpatterns = [ url(r'^email-change/$', views.email_change, name='email-change'), url(r'^email-change/(?P<token>[0-9A-Za-z_\-\.]+)/$', views.email_change_confirm, name='email-change-confirm'), - url(r'^(?P<pk>\d+)/$', views.comments, kwargs={'slug': "", }, name='detail'), - url(r'^(?P<pk>\d+)/(?P<slug>[\w-]+)/$', views.comments, name='detail'), + url(r'^(?P<pk>[0-9]+)/$', views.comments, kwargs={'slug': "", }, name='detail'), + url(r'^(?P<pk>[0-9]+)/(?P<slug>[\w-]+)/$', views.comments, name='detail'), - url(r'^topics/(?P<pk>\d+)/$', views.topics, kwargs={'slug': "", }, name='topics'), - url(r'^topics/(?P<pk>\d+)/(?P<slug>[\w-]+)/$', views.topics, name='topics'), + url(r'^topics/(?P<pk>[0-9]+)/$', views.topics, kwargs={'slug': "", }, name='topics'), + url(r'^topics/(?P<pk>[0-9]+)/(?P<slug>[\w-]+)/$', views.topics, name='topics'), - url(r'^likes/(?P<pk>\d+)/$', views.likes, kwargs={'slug': "", }, name='likes'), - url(r'^likes/(?P<pk>\d+)/(?P<slug>[\w-]+)/$', views.likes, name='likes'), + url(r'^likes/(?P<pk>[0-9]+)/$', views.likes, kwargs={'slug': "", }, name='likes'), + url(r'^likes/(?P<pk>[0-9]+)/(?P<slug>[\w-]+)/$', views.likes, name='likes'), url(r'^menu/$', views.menu, name='menu'), url(r'^', include(auth_urls, namespace='auth')), -] \ No newline at end of file +]