diff --git a/.coveragerc b/.coveragerc index 3742123..df15c9d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,6 +6,7 @@ omit = dpaste/south_migrations/* dpaste/tests/* dpaste/settings/* + dpaste/wsgi.py [report] exclude_lines = diff --git a/.travis.yml b/.travis.yml index 8e71bf5..06ec320 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,17 +2,20 @@ language: python python: - 2.7 + - 3.4 - 3.5 + - 3.6 env: - - DJANGO=1.8.* - - DJANGO=1.9.* + - DJANGO: django>=1.8,<1.9 + - DJANGO: django>=1.9,<1.10 + - DJANGO: django>=1.10,<1.11 before_install: - pip install codecov install: - - pip install django==$DJANGO + - pip install $DJANGO - pip install -e . script: diff --git a/CHANGELOG b/CHANGELOG index 873c618..ec551cf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,13 +1,41 @@ Changelog ========= -2.11 (master) ------------------ +2.14 (master) +------------- -* Dropped the Github Gist export function. +* Removed "Suspicious" middleware which was never been used, documented, + and also not functional for a while. * All views are now class based and use the latest generic based views sugar provided by Django. +2.13 (2017-01-20) +----------------- + +* (Backwards incompatible) Removal of django-mptt and therefor the removal of a + tree based snippet list, due to performance reasons with large snippet counts. + Snippets still have a 'parent' relation if it's an answer of another snippet, + however this is no longer a Nested Set. The UI is simplified too and the user + can now only compare an answer to it's parent snippet. I believe this is the + major use case anyway. +* (Backwards incompatible) Removal of the "Gist" button feature. +* Fixed broken 404 view handler in Django 1.9+. +* Python 3.6 and Django 1.10 compatibility and tests. + +2.12 (2016-09-06) +----------------- + +* Fixed "Content Type" problem with Django 1.10. +* Development requirements now use a different version scheme to be + compatible with older `pip` versions. + +2.11 (2016-09-04) +----------------- + +* Django 1.10 Support +* R Lexer is enabled by default +* Minor fixes and improvements. + 2.10 (2016-03-23) ----------------- diff --git a/README.rst b/README.rst index 94c95fc..f3614e2 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -.. image:: https://travis-ci.org/bartTC/dpaste.png?branch=master +.. image:: https://travis-ci.org/bartTC/dpaste.svg?branch=master :target: https://travis-ci.org/bartTC/dpaste .. image:: https://codecov.io/github/bartTC/dpaste/coverage.svg?branch=master diff --git a/docs/integration.rst b/docs/integration.rst index 287be49..c89dc9f 100644 --- a/docs/integration.rst +++ b/docs/integration.rst @@ -10,14 +10,12 @@ necessary dependencies of dpaste as well:: pip install dpaste -Add ``dpaste`` and ``mptt`` to your ``INSTALLED_APPS``:: +Add ``dpaste`` to your ``INSTALLED_APPS``:: INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.staticfiles', # ... - - 'mptt', 'dpaste', ) diff --git a/docs/settings.rst b/docs/settings.rst index e35f562..eca1c8d 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -95,16 +95,19 @@ behavior without touching the code: ``3600 * 24 * 30 * 12 * 100`` or simpler: ``DPASTE_EXPIRE_CHOICES[2][0]``. ``DPASTE_ENABLE_GIST`` + **Removed in Version 2.13!** Boolean. Whether to display the Gist button for re-pasting to GitHub. Default: ``True`` ..warning: This feature was removed in v2.11. ``DPASTE_DEFAULT_GIST_NAME`` + **Removed in Version 2.13!** String. The filename used when pasting a snippet on Github Gist. Default: ``dpaste.de_snippet.py`` ``DPASTE_DEFAULT_GIST_DESCRIPTION`` + **Removed in Version 2.13!** String. The filename used when pasting a snippet on Github Gist. Default: ``dpaste.de_snippet.py`` diff --git a/dpaste/context_processors.py b/dpaste/context_processors.py new file mode 100644 index 0000000..f4dbefa --- /dev/null +++ b/dpaste/context_processors.py @@ -0,0 +1,8 @@ +from django.conf import settings + +def dpaste_globals(request): + return { + 'site_name': getattr(settings, 'DPASTE_SITE_NAME', 'dpaste.de'), + 'jquery_url': getattr(settings, 'DPASTE_JQUERY_URL', + 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js'), + } diff --git a/dpaste/highlight.py b/dpaste/highlight.py index e4c129f..3ab69bd 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -84,6 +84,7 @@ LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', ( ('properties', 'Properties'), ('puppet', 'Puppet'), ('python', 'Python'), + ('r', 'R'), ('rb', 'Ruby'), ('rst', 'reStructuredText'), ('rust', 'Rust'), diff --git a/dpaste/locale/de/LC_MESSAGES/django.mo b/dpaste/locale/de/LC_MESSAGES/django.mo index 47240d2..26ffcfa 100644 Binary files a/dpaste/locale/de/LC_MESSAGES/django.mo and b/dpaste/locale/de/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/de/LC_MESSAGES/django.po b/dpaste/locale/de/LC_MESSAGES/django.po index 0d82eb0..0fd1908 100644 --- a/dpaste/locale/de/LC_MESSAGES/django.po +++ b/dpaste/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dpaste\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-08-12 04:00+0000\n" +"POT-Creation-Date: 2016-12-02 14:51+0100\n" "PO-Revision-Date: 2014-10-28 11:20+0100\n" "Last-Translator: Martin Mahner \n" "Language-Team: DE \n" @@ -18,163 +18,160 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 1.6.10\n" -#: dpaste/forms.py:11 dpaste/models.py:37 -#: dpaste/templates/dpaste/snippet_details.html:59 +#: forms.py:11 models.py:37 templates/dpaste/snippet_details.html:65 msgid "One-Time snippet" msgstr "One-Time snippet" -#: dpaste/forms.py:12 +#: forms.py:12 msgid "In one hour" msgstr "In einer Stunde" -#: dpaste/forms.py:13 +#: forms.py:13 msgid "In one week" msgstr "In einer Woche" -#: dpaste/forms.py:14 +#: forms.py:14 msgid "In one month" msgstr "In einem Monat" -#: dpaste/forms.py:15 +#: forms.py:15 msgid "Never" msgstr "Niemals" -#: dpaste/forms.py:36 dpaste/models.py:42 +#: forms.py:36 models.py:42 msgid "Content" msgstr "Inhalt" -#: dpaste/forms.py:37 +#: forms.py:37 msgid "Awesome code goes here..." msgstr "Geiler Code hier rein..." -#: dpaste/forms.py:42 dpaste/models.py:43 +#: forms.py:42 models.py:43 msgid "Lexer" msgstr "Syntax" -#: dpaste/forms.py:49 dpaste/models.py:47 +#: forms.py:49 models.py:47 msgid "Expires" msgstr "Läuft ab" -#: dpaste/forms.py:57 +#: forms.py:57 msgid "Title" msgstr "Titel" -#: dpaste/forms.py:85 +#: forms.py:85 msgid "This field is required." msgstr "Dieses Feld ist erforderlich." -#: dpaste/highlight.py:33 +#: highlight.py:33 msgid "Highlighted" msgstr "Markiert" -#: dpaste/models.py:35 +#: models.py:35 msgid "Expire by timestamp" msgstr "Nach Zeitstempel auslaufen lassen" -#: dpaste/models.py:36 +#: models.py:36 msgid "Keep Forever" msgstr "Für immer behalten" -#: dpaste/models.py:40 +#: models.py:40 msgid "Secret ID" msgstr "Geheime ID" -#: dpaste/models.py:44 +#: models.py:44 msgid "Published" msgstr "Veröffentlicht" -#: dpaste/models.py:45 +#: models.py:45 msgid "Expire Type" msgstr "Auslauftyp" -#: dpaste/models.py:48 +#: models.py:48 msgid "View count" msgstr "Anzahl der Besuche" -#: dpaste/templates/dpaste/about.html:59 +#: templates/dpaste/about.html:59 msgid "Statistics" msgstr "Statistiken" -#: dpaste/templates/dpaste/about.html:61 +#: templates/dpaste/about.html:61 #, python-format msgid "" "There are %(total)s snippets in the database. The most popular languages are:" msgstr "Es gibt %(total)s in der Datenbank. Die populärsten Sprachen sind:" -#: dpaste/templates/dpaste/base.html:8 dpaste/templates/dpaste/base.html:21 -#: dpaste/templates/dpaste/snippet_new.html:6 -#: dpaste/templates/dpaste/snippet_new.html:7 +#: templates/dpaste/base.html:7 templates/dpaste/base.html:20 +#: templates/dpaste/snippet_new.html:5 templates/dpaste/snippet_new.html:6 msgid "New snippet" msgstr "Neues Snippet" -#: dpaste/templates/dpaste/base.html:19 +#: templates/dpaste/base.html:18 msgid "About" msgstr "Über" -#: dpaste/templates/dpaste/base.html:20 +#: templates/dpaste/base.html:19 msgid "History" msgstr "Verlauf" -#: dpaste/templates/dpaste/snippet_details.html:8 -#: dpaste/templates/dpaste/snippet_details.html:9 +#: templates/dpaste/snippet_details.html:7 msgid "Snippet" msgstr "Snippet" -#: dpaste/templates/dpaste/snippet_details.html:41 +#: templates/dpaste/snippet_details.html:47 msgid "Compare" msgstr "Vergleichen" -#: dpaste/templates/dpaste/snippet_details.html:55 +#: templates/dpaste/snippet_details.html:61 #, python-format msgid "Expires in: %(date)s" msgstr "Erlischt in: %(date)s" -#: dpaste/templates/dpaste/snippet_details.html:57 +#: templates/dpaste/snippet_details.html:63 msgid "Snippet never expires" msgstr "Snippet erlischt niemals" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Really delete this snippet?" msgstr "Dieses Snippet wirklich löschen?" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Delete Now" msgstr "Jetzt löschen" -#: dpaste/templates/dpaste/snippet_details.html:66 +#: templates/dpaste/snippet_details.html:72 msgid "Compare Snippets" msgstr "Snippets vergleichen" -#: dpaste/templates/dpaste/snippet_details.html:69 +#: templates/dpaste/snippet_details.html:75 msgid "View Raw" msgstr "Unformatiert" -#: dpaste/templates/dpaste/snippet_details.html:73 +#: templates/dpaste/snippet_details.html:79 msgid "Gist" msgstr "Gist" -#: dpaste/templates/dpaste/snippet_details.html:82 +#: templates/dpaste/snippet_details.html:88 msgid "This is a one-time snippet." msgstr "Dies ist ein One-Time Snippet." -#: dpaste/templates/dpaste/snippet_details.html:84 +#: templates/dpaste/snippet_details.html:90 #, python-format msgid "It is automatically removed after %(remaining)s further views." msgstr "Es wird automatisch nach %(remaining)s weiteren Ansichten entfernt." -#: dpaste/templates/dpaste/snippet_details.html:86 +#: templates/dpaste/snippet_details.html:92 msgid "It is automatically removed after the next view." msgstr "Es wird automatisch nach der nächsten Ansicht entfernt." -#: dpaste/templates/dpaste/snippet_details.html:88 +#: templates/dpaste/snippet_details.html:94 msgid "It cannot be viewed again." msgstr "Es kann nicht noch einmal angesehen werden." -#: dpaste/templates/dpaste/snippet_details.html:108 +#: templates/dpaste/snippet_details.html:114 msgid "Reply to this snippet" msgstr "Antworte auf dieses Snippet" -#: dpaste/templates/dpaste/snippet_diff.html:5 +#: templates/dpaste/snippet_diff.html:4 #, python-format msgid "" "\n" @@ -187,28 +184,28 @@ msgstr "" "href=\"%(fileb_url)s\">#%(fileb_id)s\n" " " -#: dpaste/templates/dpaste/snippet_form.html:32 +#: templates/dpaste/snippet_form.html:31 msgid "Expire in" msgstr "Erlischt in" -#: dpaste/templates/dpaste/snippet_form.html:38 +#: templates/dpaste/snippet_form.html:37 msgid "Paste it" msgstr "Paste" -#: dpaste/templates/dpaste/snippet_form.html:39 +#: templates/dpaste/snippet_form.html:38 msgid "or" msgstr "oder" -#: dpaste/templates/dpaste/snippet_list.html:16 +#: templates/dpaste/snippet_list.html:15 msgid "DATETIME_FORMAT" msgstr "DATETIME_FORMAT" -#: dpaste/templates/dpaste/snippet_list.html:17 +#: templates/dpaste/snippet_list.html:16 #, python-format msgid "%(since)s ago" msgstr "Vor %(since)s" -#: dpaste/templates/dpaste/snippet_list.html:23 +#: templates/dpaste/snippet_list.html:22 msgid "" "No snippets saved. Either all your snippets are expired or your cookie has " "changed." @@ -216,7 +213,7 @@ msgstr "" "Keine Snippets gespeichert. Entweder sind alle deine Snippets erloschen oder " "dein Cookie hat sich geändert." -#: dpaste/views.py:199 +#: views.py:180 msgid "No changes were made between this two files." msgstr "Zwischen diesen beiden Dateien wurden keine Änderungen gemacht." diff --git a/dpaste/locale/en/LC_MESSAGES/django.mo b/dpaste/locale/en/LC_MESSAGES/django.mo index 75662a9..2c0d259 100644 Binary files a/dpaste/locale/en/LC_MESSAGES/django.mo and b/dpaste/locale/en/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/en/LC_MESSAGES/django.po b/dpaste/locale/en/LC_MESSAGES/django.po index 5b062c8..0ed69b7 100644 --- a/dpaste/locale/en/LC_MESSAGES/django.po +++ b/dpaste/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-08-12 04:00+0000\n" +"POT-Creation-Date: 2016-12-02 14:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,163 +17,160 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: dpaste/forms.py:11 dpaste/models.py:37 -#: dpaste/templates/dpaste/snippet_details.html:59 +#: forms.py:11 models.py:37 templates/dpaste/snippet_details.html:65 msgid "One-Time snippet" msgstr "" -#: dpaste/forms.py:12 +#: forms.py:12 msgid "In one hour" msgstr "" -#: dpaste/forms.py:13 +#: forms.py:13 msgid "In one week" msgstr "" -#: dpaste/forms.py:14 +#: forms.py:14 msgid "In one month" msgstr "" -#: dpaste/forms.py:15 +#: forms.py:15 msgid "Never" msgstr "" -#: dpaste/forms.py:36 dpaste/models.py:42 +#: forms.py:36 models.py:42 msgid "Content" msgstr "" -#: dpaste/forms.py:37 +#: forms.py:37 msgid "Awesome code goes here..." msgstr "" -#: dpaste/forms.py:42 dpaste/models.py:43 +#: forms.py:42 models.py:43 msgid "Lexer" msgstr "" -#: dpaste/forms.py:49 dpaste/models.py:47 +#: forms.py:49 models.py:47 msgid "Expires" msgstr "" -#: dpaste/forms.py:57 +#: forms.py:57 msgid "Title" msgstr "" -#: dpaste/forms.py:85 +#: forms.py:85 msgid "This field is required." msgstr "" -#: dpaste/highlight.py:33 +#: highlight.py:33 msgid "Highlighted" msgstr "" -#: dpaste/models.py:35 +#: models.py:35 msgid "Expire by timestamp" msgstr "" -#: dpaste/models.py:36 +#: models.py:36 msgid "Keep Forever" msgstr "" -#: dpaste/models.py:40 +#: models.py:40 msgid "Secret ID" msgstr "" -#: dpaste/models.py:44 +#: models.py:44 msgid "Published" msgstr "" -#: dpaste/models.py:45 +#: models.py:45 msgid "Expire Type" msgstr "" -#: dpaste/models.py:48 +#: models.py:48 msgid "View count" msgstr "" -#: dpaste/templates/dpaste/about.html:59 +#: templates/dpaste/about.html:59 msgid "Statistics" msgstr "" -#: dpaste/templates/dpaste/about.html:61 +#: templates/dpaste/about.html:61 #, python-format msgid "" "There are %(total)s snippets in the database. The most popular languages are:" msgstr "" -#: dpaste/templates/dpaste/base.html:8 dpaste/templates/dpaste/base.html:21 -#: dpaste/templates/dpaste/snippet_new.html:6 -#: dpaste/templates/dpaste/snippet_new.html:7 +#: templates/dpaste/base.html:7 templates/dpaste/base.html:20 +#: templates/dpaste/snippet_new.html:5 templates/dpaste/snippet_new.html:6 msgid "New snippet" msgstr "" -#: dpaste/templates/dpaste/base.html:19 +#: templates/dpaste/base.html:18 msgid "About" msgstr "" -#: dpaste/templates/dpaste/base.html:20 +#: templates/dpaste/base.html:19 msgid "History" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:8 -#: dpaste/templates/dpaste/snippet_details.html:9 +#: templates/dpaste/snippet_details.html:7 msgid "Snippet" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:41 +#: templates/dpaste/snippet_details.html:47 msgid "Compare" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:55 +#: templates/dpaste/snippet_details.html:61 #, python-format msgid "Expires in: %(date)s" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:57 +#: templates/dpaste/snippet_details.html:63 msgid "Snippet never expires" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Really delete this snippet?" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Delete Now" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:66 +#: templates/dpaste/snippet_details.html:72 msgid "Compare Snippets" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:69 +#: templates/dpaste/snippet_details.html:75 msgid "View Raw" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:73 +#: templates/dpaste/snippet_details.html:79 msgid "Gist" msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:82 +#: templates/dpaste/snippet_details.html:88 msgid "This is a one-time snippet." msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:84 +#: templates/dpaste/snippet_details.html:90 #, python-format msgid "It is automatically removed after %(remaining)s further views." msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:86 +#: templates/dpaste/snippet_details.html:92 msgid "It is automatically removed after the next view." msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:88 +#: templates/dpaste/snippet_details.html:94 msgid "It cannot be viewed again." msgstr "" -#: dpaste/templates/dpaste/snippet_details.html:108 +#: templates/dpaste/snippet_details.html:114 msgid "Reply to this snippet" msgstr "" -#: dpaste/templates/dpaste/snippet_diff.html:5 +#: templates/dpaste/snippet_diff.html:4 #, python-format msgid "" "\n" @@ -182,33 +179,33 @@ msgid "" " " msgstr "" -#: dpaste/templates/dpaste/snippet_form.html:32 +#: templates/dpaste/snippet_form.html:31 msgid "Expire in" msgstr "" -#: dpaste/templates/dpaste/snippet_form.html:38 +#: templates/dpaste/snippet_form.html:37 msgid "Paste it" msgstr "" -#: dpaste/templates/dpaste/snippet_form.html:39 +#: templates/dpaste/snippet_form.html:38 msgid "or" msgstr "" -#: dpaste/templates/dpaste/snippet_list.html:16 +#: templates/dpaste/snippet_list.html:15 msgid "DATETIME_FORMAT" msgstr "" -#: dpaste/templates/dpaste/snippet_list.html:17 +#: templates/dpaste/snippet_list.html:16 #, python-format msgid "%(since)s ago" msgstr "" -#: dpaste/templates/dpaste/snippet_list.html:23 +#: templates/dpaste/snippet_list.html:22 msgid "" "No snippets saved. Either all your snippets are expired or your cookie has " "changed." msgstr "" -#: dpaste/views.py:199 +#: views.py:180 msgid "No changes were made between this two files." msgstr "" diff --git a/dpaste/locale/es/LC_MESSAGES/django.mo b/dpaste/locale/es/LC_MESSAGES/django.mo index bd42823..75e00ce 100644 Binary files a/dpaste/locale/es/LC_MESSAGES/django.mo and b/dpaste/locale/es/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/es/LC_MESSAGES/django.po b/dpaste/locale/es/LC_MESSAGES/django.po index b9a1fdb..da1941f 100644 --- a/dpaste/locale/es/LC_MESSAGES/django.po +++ b/dpaste/locale/es/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: dpaste\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-08-12 04:00+0000\n" +"POT-Creation-Date: 2016-12-02 14:51+0100\n" "PO-Revision-Date: 2014-10-27 17:05+0000\n" "Last-Translator: Leonardo J. Caballero G. \n" "Language-Team: Spanish (http://www.transifex.com/projects/p/dpaste/language/" @@ -20,84 +20,83 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: dpaste/forms.py:11 dpaste/models.py:37 -#: dpaste/templates/dpaste/snippet_details.html:59 +#: forms.py:11 models.py:37 templates/dpaste/snippet_details.html:65 msgid "One-Time snippet" msgstr "Apenas una visualización" -#: dpaste/forms.py:12 +#: forms.py:12 msgid "In one hour" msgstr "En una hora" -#: dpaste/forms.py:13 +#: forms.py:13 msgid "In one week" msgstr "En una semana" -#: dpaste/forms.py:14 +#: forms.py:14 msgid "In one month" msgstr "En un mes" -#: dpaste/forms.py:15 +#: forms.py:15 msgid "Never" msgstr "Nunca" -#: dpaste/forms.py:36 dpaste/models.py:42 +#: forms.py:36 models.py:42 msgid "Content" msgstr "Contenido" -#: dpaste/forms.py:37 +#: forms.py:37 msgid "Awesome code goes here..." msgstr "Su código increíble va aquí..." -#: dpaste/forms.py:42 dpaste/models.py:43 +#: forms.py:42 models.py:43 msgid "Lexer" msgstr "Lexer" -#: dpaste/forms.py:49 dpaste/models.py:47 +#: forms.py:49 models.py:47 msgid "Expires" msgstr "Caduca" -#: dpaste/forms.py:57 +#: forms.py:57 msgid "Title" msgstr "Título" -#: dpaste/forms.py:85 +#: forms.py:85 msgid "This field is required." msgstr "Este campo es obligatorio." -#: dpaste/highlight.py:33 +#: highlight.py:33 msgid "Highlighted" msgstr "Destacado" -#: dpaste/models.py:35 +#: models.py:35 msgid "Expire by timestamp" msgstr "Caduca por fecha y hora" -#: dpaste/models.py:36 +#: models.py:36 msgid "Keep Forever" msgstr "Guarde por siempre" -#: dpaste/models.py:40 +#: models.py:40 msgid "Secret ID" msgstr "ID secreto" -#: dpaste/models.py:44 +#: models.py:44 msgid "Published" msgstr "Publicado" -#: dpaste/models.py:45 +#: models.py:45 msgid "Expire Type" msgstr "Tipo de Caducidad " -#: dpaste/models.py:48 +#: models.py:48 msgid "View count" msgstr "Visualizaciones" -#: dpaste/templates/dpaste/about.html:59 +#: templates/dpaste/about.html:59 msgid "Statistics" msgstr " Estadísticas" -#: dpaste/templates/dpaste/about.html:61 +#: templates/dpaste/about.html:61 #, python-format msgid "" "There are %(total)s snippets in the database. The most popular languages are:" @@ -105,81 +104,79 @@ msgstr "" "Hay %(total)s fragmentos en la base de datos. Los lenguajes más populares " "son:" -#: dpaste/templates/dpaste/base.html:8 dpaste/templates/dpaste/base.html:21 -#: dpaste/templates/dpaste/snippet_new.html:6 -#: dpaste/templates/dpaste/snippet_new.html:7 +#: templates/dpaste/base.html:7 templates/dpaste/base.html:20 +#: templates/dpaste/snippet_new.html:5 templates/dpaste/snippet_new.html:6 msgid "New snippet" msgstr "Nuevo fragmento" -#: dpaste/templates/dpaste/base.html:19 +#: templates/dpaste/base.html:18 msgid "About" msgstr "Acerca" -#: dpaste/templates/dpaste/base.html:20 +#: templates/dpaste/base.html:19 msgid "History" msgstr "Histórico" -#: dpaste/templates/dpaste/snippet_details.html:8 -#: dpaste/templates/dpaste/snippet_details.html:9 +#: templates/dpaste/snippet_details.html:7 msgid "Snippet" msgstr "Fragmento" -#: dpaste/templates/dpaste/snippet_details.html:41 +#: templates/dpaste/snippet_details.html:47 msgid "Compare" msgstr "Comparar" -#: dpaste/templates/dpaste/snippet_details.html:55 +#: templates/dpaste/snippet_details.html:61 #, python-format msgid "Expires in: %(date)s" msgstr "Caduca en: %(date)s" -#: dpaste/templates/dpaste/snippet_details.html:57 +#: templates/dpaste/snippet_details.html:63 msgid "Snippet never expires" msgstr "El fragmento nunca caduca" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Really delete this snippet?" msgstr "¿Realmente desea eliminar este fragmento?" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Delete Now" msgstr "Eliminar ahora" -#: dpaste/templates/dpaste/snippet_details.html:66 +#: templates/dpaste/snippet_details.html:72 msgid "Compare Snippets" msgstr "Comparar Snippets" -#: dpaste/templates/dpaste/snippet_details.html:69 +#: templates/dpaste/snippet_details.html:75 msgid "View Raw" msgstr "Ver en crudo" -#: dpaste/templates/dpaste/snippet_details.html:73 +#: templates/dpaste/snippet_details.html:79 msgid "Gist" msgstr "Gist" -#: dpaste/templates/dpaste/snippet_details.html:82 +#: templates/dpaste/snippet_details.html:88 msgid "This is a one-time snippet." msgstr "Este fragmento podrá ser visualizado apenas sólo una vez." -#: dpaste/templates/dpaste/snippet_details.html:84 +#: templates/dpaste/snippet_details.html:90 #, python-format msgid "It is automatically removed after %(remaining)s further views." msgstr "" "Automáticamente eliminado después de más %(remaining)s visualizaciones." -#: dpaste/templates/dpaste/snippet_details.html:86 +#: templates/dpaste/snippet_details.html:92 msgid "It is automatically removed after the next view." msgstr "Automáticamente eliminado después de la próxima visualización." -#: dpaste/templates/dpaste/snippet_details.html:88 +#: templates/dpaste/snippet_details.html:94 msgid "It cannot be viewed again." msgstr "No puede sera más visualizado." -#: dpaste/templates/dpaste/snippet_details.html:108 +#: templates/dpaste/snippet_details.html:114 msgid "Reply to this snippet" msgstr "Responder fragmento" -#: dpaste/templates/dpaste/snippet_diff.html:5 +#: templates/dpaste/snippet_diff.html:4 #, python-format msgid "" "\n" @@ -191,28 +188,28 @@ msgstr "" "Comparar entre #%(filea_id)s y #%(fileb_id)s" -#: dpaste/templates/dpaste/snippet_form.html:32 +#: templates/dpaste/snippet_form.html:31 msgid "Expire in" msgstr "Caduca en" -#: dpaste/templates/dpaste/snippet_form.html:38 +#: templates/dpaste/snippet_form.html:37 msgid "Paste it" msgstr "Pegarlo" -#: dpaste/templates/dpaste/snippet_form.html:39 +#: templates/dpaste/snippet_form.html:38 msgid "or" msgstr "" -#: dpaste/templates/dpaste/snippet_list.html:16 +#: templates/dpaste/snippet_list.html:15 msgid "DATETIME_FORMAT" msgstr "DATETIME_FORMAT" -#: dpaste/templates/dpaste/snippet_list.html:17 +#: templates/dpaste/snippet_list.html:16 #, python-format msgid "%(since)s ago" msgstr "%(since)s atrás" -#: dpaste/templates/dpaste/snippet_list.html:23 +#: templates/dpaste/snippet_list.html:22 msgid "" "No snippets saved. Either all your snippets are expired or your cookie has " "changed." @@ -220,6 +217,6 @@ msgstr "" "No hay fragmentos guardados. O sus fragmentos han caducado o su cookie " "cambió." -#: dpaste/views.py:199 +#: views.py:180 msgid "No changes were made between this two files." msgstr "No hay cambios entre estos dos archivos." diff --git a/dpaste/locale/he/LC_MESSAGES/django.mo b/dpaste/locale/he/LC_MESSAGES/django.mo new file mode 100644 index 0000000..0a1188b Binary files /dev/null and b/dpaste/locale/he/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/he/LC_MESSAGES/django.po b/dpaste/locale/he/LC_MESSAGES/django.po new file mode 100644 index 0000000..f71f18a --- /dev/null +++ b/dpaste/locale/he/LC_MESSAGES/django.po @@ -0,0 +1,214 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# GenghisKhan , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-02 14:51+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: GenghisKhan \n" +"Language-Team: Hebrew \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Language: he\n" +"X-Source-Language: en\n" + +#: forms.py:11 models.py:37 templates/dpaste/snippet_details.html:65 +msgid "One-Time snippet" +msgstr "חתיכה חד-פעמית" + +#: forms.py:12 +msgid "In one hour" +msgstr "בתוך שעה אחת" + +#: forms.py:13 +msgid "In one week" +msgstr "בתוך שבוע אחד" + +#: forms.py:14 +msgid "In one month" +msgstr "בתוך חודש אחד" + +#: forms.py:15 +msgid "Never" +msgstr "לעולם לא" + +#: forms.py:36 models.py:42 +msgid "Content" +msgstr "תוכן" + +#: forms.py:37 +msgid "Awesome code goes here..." +msgstr "קוד מגניב הולך לכאן..." + +#: forms.py:42 models.py:43 +msgid "Lexer" +msgstr "Lexer" + +#: forms.py:49 models.py:47 +msgid "Expires" +msgstr "פג" + +#: forms.py:57 +msgid "Title" +msgstr "כותרת" + +#: forms.py:85 +msgid "This field is required." +msgstr "שדה זה הינו נדרש." + +#: highlight.py:33 +msgid "Highlighted" +msgstr "מודגשים" + +#: models.py:35 +msgid "Expire by timestamp" +msgstr "פוקע לפי חותמת זמן" + +#: models.py:36 +msgid "Keep Forever" +msgstr "שמור לנצח" + +#: models.py:40 +msgid "Secret ID" +msgstr "מזהה סודי" + +#: models.py:44 +msgid "Published" +msgstr "פורסם" + +#: models.py:45 +msgid "Expire Type" +msgstr "טיפוס תפוגה" + +#: models.py:48 +msgid "View count" +msgstr "מונה צפיות" + +#: templates/dpaste/about.html:59 +msgid "Statistics" +msgstr "סטטיסטיקות" + +#: templates/dpaste/about.html:61 +#, python-format +msgid "" +"There are %(total)s snippets in the database. The most popular languages are:" +msgstr "ישנן %(total)s חתיכות במסד נתונים. השפות השכיחות ביותר הן:" + +#: templates/dpaste/base.html:7 templates/dpaste/base.html:20 +#: templates/dpaste/snippet_new.html:5 templates/dpaste/snippet_new.html:6 +msgid "New snippet" +msgstr "חתיכה חדשה" + +#: templates/dpaste/base.html:18 +msgid "About" +msgstr "אודות" + +#: templates/dpaste/base.html:19 +msgid "History" +msgstr "היסטוריה" + +#: templates/dpaste/snippet_details.html:7 +msgid "Snippet" +msgstr "חתיכה" + +#: templates/dpaste/snippet_details.html:47 +msgid "Compare" +msgstr "השווה" + +#: templates/dpaste/snippet_details.html:61 +#, python-format +msgid "Expires in: %(date)s" +msgstr "פג ביום: %(date)s" + +#: templates/dpaste/snippet_details.html:63 +msgid "Snippet never expires" +msgstr "חתיכה לעלום לא פוקעת" + +#: templates/dpaste/snippet_details.html:69 +msgid "Really delete this snippet?" +msgstr "באמת למחוק את חתיכה זו?" + +#: templates/dpaste/snippet_details.html:69 +msgid "Delete Now" +msgstr "מחק עכשיו" + +#: templates/dpaste/snippet_details.html:72 +msgid "Compare Snippets" +msgstr "השווה חתיכות" + +#: templates/dpaste/snippet_details.html:75 +msgid "View Raw" +msgstr "הצג גולמי" + +#: templates/dpaste/snippet_details.html:79 +msgid "Gist" +msgstr "Gist" + +#: templates/dpaste/snippet_details.html:88 +msgid "This is a one-time snippet." +msgstr "זןהי חתיכה חד-פעמית." + +#: templates/dpaste/snippet_details.html:90 +#, python-format +msgid "It is automatically removed after %(remaining)s further views." +msgstr "זה יוסר אוטומטית לאחר %(remaining)s צפיות נוספות." + +#: templates/dpaste/snippet_details.html:92 +msgid "It is automatically removed after the next view." +msgstr "זה יוסר אוטומטית לאחר הצפיה הבאה." + +#: templates/dpaste/snippet_details.html:94 +msgid "It cannot be viewed again." +msgstr "אין אפשרות לצפות בזה שוב." + +#: templates/dpaste/snippet_details.html:114 +msgid "Reply to this snippet" +msgstr "השב לחתיכה זו" + +#: templates/dpaste/snippet_diff.html:4 +#, python-format +msgid "" +" Diff between #%(filea_id)s and #%(fileb_id)s\n" +msgstr "" +" הבדל בין #%(filea_id)s לנגד #%(fileb_id)s\n" + +#: templates/dpaste/snippet_form.html:31 +msgid "Expire in" +msgstr "פג בתוך" + +#: templates/dpaste/snippet_form.html:37 +msgid "Paste it" +msgstr "הדבק זאת" + +#: templates/dpaste/snippet_form.html:38 +msgid "or" +msgstr "או" + +#: templates/dpaste/snippet_list.html:15 +msgid "DATETIME_FORMAT" +msgstr "" + +#: templates/dpaste/snippet_list.html:16 +#, python-format +msgid "%(since)s ago" +msgstr "לפני %(since)s" + +#: templates/dpaste/snippet_list.html:22 +msgid "" +"No snippets saved. Either all your snippets are expired or your cookie has " +"changed." +msgstr "לא נשמרו חתיכות. או שכל החתיכות שלך פקעו או שהעוגיות שלך שונו." + +#: views.py:180 +msgid "No changes were made between this two files." +msgstr "לא נערכו שינויים בין שני קבצים אלה." diff --git a/dpaste/locale/pt_BR/LC_MESSAGES/django.mo b/dpaste/locale/pt_BR/LC_MESSAGES/django.mo index 3c503ca..c3bf467 100644 Binary files a/dpaste/locale/pt_BR/LC_MESSAGES/django.mo and b/dpaste/locale/pt_BR/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/pt_BR/LC_MESSAGES/django.po b/dpaste/locale/pt_BR/LC_MESSAGES/django.po index 37eab6e..f5d3d96 100644 --- a/dpaste/locale/pt_BR/LC_MESSAGES/django.po +++ b/dpaste/locale/pt_BR/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: dpaste\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-08-12 04:00+0000\n" +"POT-Creation-Date: 2016-12-02 14:51+0100\n" "PO-Revision-Date: 2014-10-25 14:25+0000\n" "Last-Translator: Sergio Oliveira \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/" @@ -19,163 +19,160 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: dpaste/forms.py:11 dpaste/models.py:37 -#: dpaste/templates/dpaste/snippet_details.html:59 +#: forms.py:11 models.py:37 templates/dpaste/snippet_details.html:65 msgid "One-Time snippet" msgstr "Uma única visualização" -#: dpaste/forms.py:12 +#: forms.py:12 msgid "In one hour" msgstr "Em uma hora" -#: dpaste/forms.py:13 +#: forms.py:13 msgid "In one week" msgstr "Em uma semana" -#: dpaste/forms.py:14 +#: forms.py:14 msgid "In one month" msgstr "Em um mês" -#: dpaste/forms.py:15 +#: forms.py:15 msgid "Never" msgstr "Nunca expira" -#: dpaste/forms.py:36 dpaste/models.py:42 +#: forms.py:36 models.py:42 msgid "Content" msgstr "Conteúdo" -#: dpaste/forms.py:37 +#: forms.py:37 msgid "Awesome code goes here..." msgstr "Cole seu texto ou código aqui..." -#: dpaste/forms.py:42 dpaste/models.py:43 +#: forms.py:42 models.py:43 msgid "Lexer" msgstr "Lexer" -#: dpaste/forms.py:49 dpaste/models.py:47 +#: forms.py:49 models.py:47 msgid "Expires" msgstr "Validade" -#: dpaste/forms.py:57 +#: forms.py:57 msgid "Title" msgstr "Título" -#: dpaste/forms.py:85 +#: forms.py:85 msgid "This field is required." msgstr "Campo obrigatório." -#: dpaste/highlight.py:33 +#: highlight.py:33 msgid "Highlighted" msgstr "Highlighted" -#: dpaste/models.py:35 +#: models.py:35 msgid "Expire by timestamp" msgstr "Expira por tempo" -#: dpaste/models.py:36 +#: models.py:36 msgid "Keep Forever" msgstr "Não expira" -#: dpaste/models.py:40 +#: models.py:40 msgid "Secret ID" msgstr "ID secreto" -#: dpaste/models.py:44 +#: models.py:44 msgid "Published" msgstr "Publicado" -#: dpaste/models.py:45 +#: models.py:45 msgid "Expire Type" msgstr "Tipo de validade" -#: dpaste/models.py:48 +#: models.py:48 msgid "View count" msgstr "Visualizações" -#: dpaste/templates/dpaste/about.html:59 +#: templates/dpaste/about.html:59 msgid "Statistics" msgstr "Estatísticas" -#: dpaste/templates/dpaste/about.html:61 +#: templates/dpaste/about.html:61 #, python-format msgid "" "There are %(total)s snippets in the database. The most popular languages are:" msgstr "Existem %(total)s pastes no banco de dados. A linguagem mais popular é" -#: dpaste/templates/dpaste/base.html:8 dpaste/templates/dpaste/base.html:21 -#: dpaste/templates/dpaste/snippet_new.html:6 -#: dpaste/templates/dpaste/snippet_new.html:7 +#: templates/dpaste/base.html:7 templates/dpaste/base.html:20 +#: templates/dpaste/snippet_new.html:5 templates/dpaste/snippet_new.html:6 msgid "New snippet" msgstr "Novo paste" -#: dpaste/templates/dpaste/base.html:19 +#: templates/dpaste/base.html:18 msgid "About" msgstr "Sobre" -#: dpaste/templates/dpaste/base.html:20 +#: templates/dpaste/base.html:19 msgid "History" msgstr "Histórico" -#: dpaste/templates/dpaste/snippet_details.html:8 -#: dpaste/templates/dpaste/snippet_details.html:9 +#: templates/dpaste/snippet_details.html:7 msgid "Snippet" msgstr "Paste" -#: dpaste/templates/dpaste/snippet_details.html:41 +#: templates/dpaste/snippet_details.html:47 msgid "Compare" msgstr "Comparar" -#: dpaste/templates/dpaste/snippet_details.html:55 +#: templates/dpaste/snippet_details.html:61 #, python-format msgid "Expires in: %(date)s" msgstr "Expira em: %(date)s" -#: dpaste/templates/dpaste/snippet_details.html:57 +#: templates/dpaste/snippet_details.html:63 msgid "Snippet never expires" msgstr "Paste nunca expira" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Really delete this snippet?" msgstr "Deseja realmente remover esse paste?" -#: dpaste/templates/dpaste/snippet_details.html:63 +#: templates/dpaste/snippet_details.html:69 msgid "Delete Now" msgstr "Remover agora" -#: dpaste/templates/dpaste/snippet_details.html:66 +#: templates/dpaste/snippet_details.html:72 msgid "Compare Snippets" msgstr "Comparar pastes" -#: dpaste/templates/dpaste/snippet_details.html:69 +#: templates/dpaste/snippet_details.html:75 msgid "View Raw" msgstr "Visualizar sem formatação" -#: dpaste/templates/dpaste/snippet_details.html:73 +#: templates/dpaste/snippet_details.html:79 msgid "Gist" msgstr "Gist" -#: dpaste/templates/dpaste/snippet_details.html:82 +#: templates/dpaste/snippet_details.html:88 msgid "This is a one-time snippet." msgstr "Este paste só pode ser visualizado uma vez." -#: dpaste/templates/dpaste/snippet_details.html:84 +#: templates/dpaste/snippet_details.html:90 #, python-format msgid "It is automatically removed after %(remaining)s further views." msgstr "Automaticamente deletado depois de %(remaining)s visualizações" -#: dpaste/templates/dpaste/snippet_details.html:86 +#: templates/dpaste/snippet_details.html:92 msgid "It is automatically removed after the next view." msgstr "Automaticamente deletado após a próxima visualização." -#: dpaste/templates/dpaste/snippet_details.html:88 +#: templates/dpaste/snippet_details.html:94 msgid "It cannot be viewed again." msgstr "Não pode ser visto novamente." -#: dpaste/templates/dpaste/snippet_details.html:108 +#: templates/dpaste/snippet_details.html:114 msgid "Reply to this snippet" msgstr "Responder paste" -#: dpaste/templates/dpaste/snippet_diff.html:5 +#: templates/dpaste/snippet_diff.html:4 #, python-format msgid "" "\n" @@ -188,28 +185,28 @@ msgstr "" "\"%(fileb_url)s\">#%(fileb_id)s\n" " " -#: dpaste/templates/dpaste/snippet_form.html:32 +#: templates/dpaste/snippet_form.html:31 msgid "Expire in" msgstr "Expira em" -#: dpaste/templates/dpaste/snippet_form.html:38 +#: templates/dpaste/snippet_form.html:37 msgid "Paste it" msgstr "Criar paste" -#: dpaste/templates/dpaste/snippet_form.html:39 +#: templates/dpaste/snippet_form.html:38 msgid "or" msgstr "" -#: dpaste/templates/dpaste/snippet_list.html:16 +#: templates/dpaste/snippet_list.html:15 msgid "DATETIME_FORMAT" msgstr "DATETIME_FORMAT" -#: dpaste/templates/dpaste/snippet_list.html:17 +#: templates/dpaste/snippet_list.html:16 #, python-format msgid "%(since)s ago" msgstr "%(since)s atrás" -#: dpaste/templates/dpaste/snippet_list.html:23 +#: templates/dpaste/snippet_list.html:22 msgid "" "No snippets saved. Either all your snippets are expired or your cookie has " "changed." @@ -217,6 +214,6 @@ msgstr "" "Nenhum paste salvo. Ou todos os seus pastes expiraram ou seu cookie foi " "alterado." -#: dpaste/views.py:199 +#: views.py:180 msgid "No changes were made between this two files." msgstr "Nenhuma alterção feita entre esses dois arquivos." diff --git a/dpaste/management/commands/cleanup_snippets.py b/dpaste/management/commands/cleanup_snippets.py index c24e6ec..37776b0 100644 --- a/dpaste/management/commands/cleanup_snippets.py +++ b/dpaste/management/commands/cleanup_snippets.py @@ -1,29 +1,32 @@ import sys from optparse import make_option -from django.core.management.base import LabelCommand +from django.core.management.base import BaseCommand from django.utils import timezone from dpaste.models import Snippet -class Command(LabelCommand): - option_list = LabelCommand.option_list + ( - make_option('--dry-run', '-d', action='store_true', dest='dry_run', - help='Don\'t do anything.'), - ) +class Command(BaseCommand): help = "Purges snippets that are expired" + def add_arguments(self, parser): + parser.add_argument('--dry-run', action='store_true', dest='dry_run', + help='Don\'t do anything.'), + def handle(self, *args, **options): deleteable_snippets = Snippet.objects.filter( expires__isnull=False, expire_type=Snippet.EXPIRE_TIME, expires__lte=timezone.now() ) - sys.stdout.write(u"%s snippets gets deleted:\n" % deleteable_snippets.count()) + if len(deleteable_snippets) == 0: + self.stdout.write(u"No snippets to delete.") + return None + self.stdout.write(u"Will delete %s snippet(s):\n" % deleteable_snippets.count()) for d in deleteable_snippets: - sys.stdout.write(u"- %s (%s)\n" % (d.secret_id, d.expires)) + self.stdout.write(u"- %s (%s)\n" % (d.secret_id, d.expires)) if options.get('dry_run'): - sys.stdout.write(u'Dry run - Not actually deleting snippets!\n') + self.stdout.write(u'Dry run - Not actually deleting snippets!\n') else: deleteable_snippets.delete() diff --git a/dpaste/middleware.py b/dpaste/middleware.py deleted file mode 100644 index d152c08..0000000 --- a/dpaste/middleware.py +++ /dev/null @@ -1,62 +0,0 @@ -import socket - -from django.http import HttpResponseBadRequest - -tor_bl = ( - '{remote_addr}.{server_port}.{server_ip}' - '.ip-port.exitlist.torproject.org') -open_proxy_bl = ('{remote_addr}.dnsbl.proxybl.org') - -rev_ip = lambda ip: '.'.join(reversed(ip.split('.'))) # pragma: no cover - -response = """

Access denied

-

It appears you're requesting this page from an open proxy or -the TOR network. These networks are blocked due to numerous -statutory violation related posts in the past.

-

If you think this is wrong, file -a bug on Github please.

""" - -def in_blacklist(request, bl, ip=None): # pragma: no cover - ip = ip or request.META['REMOTE_ADDR'] - try: - server_ip = socket.gethostbyname(request.META['SERVER_NAME']) - except socket.gaierror: - return - bl_name = bl.format( - remote_addr=rev_ip(ip), - server_port=request.META['SERVER_PORT'], - server_ip=rev_ip(server_ip) - ) - try: - lookup = socket.gethostbyname(bl_name) - except socket.gaierror as s: - if s.errno == -5: - return False - return - except Exception: - return - return lookup == '127.0.0.2' - - -class SuspiciousIPMiddleware(object): # pragma: no cover - - def process_request(self, request): - def check_tor(): - if not hasattr(request, '_is_tor_exit_node'): - request._is_tor_exit_node = in_blacklist(request, tor_bl) - return request._is_tor_exit_node - request.is_tor_exit_node = check_tor - - def check_open_proxy(): - if not hasattr(request, '_is_open_proxy'): - request._is_open_proxy = in_blacklist( - request, open_proxy_bl) - return request._is_open_proxy - request.is_open_proxy = check_open_proxy - - def check_suspicious(): - return request.is_tor_exit_node() or request.is_open_proxy() - - request.is_suspicious = check_suspicious - if request.method == 'POST' and request.is_suspicious(): - return HttpResponseBadRequest(response) diff --git a/dpaste/migrations/0002_auto_20170119_1038.py b/dpaste/migrations/0002_auto_20170119_1038.py new file mode 100644 index 0000000..aced2eb --- /dev/null +++ b/dpaste/migrations/0002_auto_20170119_1038.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-01-19 10:38 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dpaste', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='snippet', + name='level', + ), + migrations.RemoveField( + model_name='snippet', + name='lft', + ), + migrations.RemoveField( + model_name='snippet', + name='rght', + ), + migrations.RemoveField( + model_name='snippet', + name='tree_id', + ), + ] diff --git a/dpaste/models.py b/dpaste/models.py index 977b28c..cb98bc2 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -1,6 +1,5 @@ from random import SystemRandom -import mptt from django.conf import settings from django.core.urlresolvers import reverse from django.db import models @@ -59,10 +58,6 @@ class Snippet(models.Model): return remaining > 0 and remaining or 0 return None - @property - def is_single(self): - return self.is_root_node() and not self.get_children() - def save(self, *args, **kwargs): if not self.secret_id: self.secret_id = generate_secret_id() @@ -73,5 +68,3 @@ class Snippet(models.Model): def __unicode__(self): return self.secret_id - -mptt.register(Snippet, order_insertion_by=['content']) diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index f783da8..43658df 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -105,6 +105,7 @@ TEMPLATES = [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.template.context_processors.i18n', + 'dpaste.context_processors.dpaste_globals', ], }, }, @@ -113,7 +114,6 @@ TEMPLATES = [ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django.contrib.sessions', - 'mptt', 'gunicorn', 'dpaste', ) diff --git a/dpaste/settings/local.py.example b/dpaste/settings/local.py.example index b9e789a..00716ba 100644 --- a/dpaste/settings/local.py.example +++ b/dpaste/settings/local.py.example @@ -1,7 +1,6 @@ from dpaste.settings.base import * DEBUG = True -TEMPLATE_DEBUG = DEBUG ADMINS = ( #('Your Name', 'name@example.com'), @@ -10,9 +9,9 @@ MANAGERS = ADMINS DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.mysql', + 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'dpaste', - 'USER': 'root', + 'USER': '', 'PASSWORD': '', } } diff --git a/dpaste/static/dpaste/clipboardjs.min.js b/dpaste/static/dpaste/clipboardjs.min.js new file mode 100644 index 0000000..efbbd7f --- /dev/null +++ b/dpaste/static/dpaste/clipboardjs.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.15 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Clipboard=e()}}(function(){var e,t,n;return function e(t,n,i){function o(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return o(n?n:e)},u,u.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function e(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function e(){var t=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var i=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.addEventListener("focus",window.scrollTo(0,i)),this.fakeElem.style.top=i+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,o.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function e(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function e(){this.selectedText=(0,o.default)(this.target),this.copyText()}},{key:"copyText",value:function e(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function e(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function e(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function e(){this.removeFake()}},{key:"action",set:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function e(){return this._action}},{key:"target",set:function e(t){if(void 0!==t){if(!t||"object"!==("undefined"==typeof t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function e(){return this._target}}]),e}();e.exports=c})},{select:5}],8:[function(t,n,i){!function(o,r){if("function"==typeof e&&e.amd)e(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof i)r(n,t("./clipboard-action"),t("tiny-emitter"),t("good-listener"));else{var a={exports:{}};r(a,o.clipboardAction,o.tinyEmitter,o.goodListener),o.clipboard=a.exports}}(this,function(e,t,n,i){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n="data-clipboard-"+e;if(t.hasAttribute(n))return t.getAttribute(n)}var s=o(t),u=o(n),f=o(i),d=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function e(t){var n=this;this.listener=(0,f.default)(t,"click",function(e){return n.onClick(e)})}},{key:"onClick",value:function e(t){var n=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})}},{key:"defaultAction",value:function e(t){return l("action",t)}},{key:"defaultTarget",value:function e(t){var n=l("target",t);if(n)return document.querySelector(n)}},{key:"defaultText",value:function e(t){return l("text",t)}},{key:"destroy",value:function e(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}]),t}(u.default);e.exports=h})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)}); diff --git a/dpaste/static/dpaste/theme.css b/dpaste/static/dpaste/theme.css index 42aed6c..ddf08c5 100644 --- a/dpaste/static/dpaste/theme.css +++ b/dpaste/static/dpaste/theme.css @@ -63,6 +63,20 @@ tt strong { color: #5393b4; } +input.headline-url { + font-size: 20px; + height: 40px; + width: 210px; + color: #5393b4; + border: none; + box-shadow: none; +} + +button.btn.headline-url-copy { + margin-top: -4px; + padding: 5px 10px 3px 10px; +} + h1, h2, h3, h4 { font-weight: 300; } diff --git a/dpaste/templates/dpaste/about.html b/dpaste/templates/dpaste/about.html index ac519ed..aee113d 100644 --- a/dpaste/templates/dpaste/about.html +++ b/dpaste/templates/dpaste/about.html @@ -53,6 +53,7 @@
  • dpasteGUI, a OS X interface
  • a dpaste Sublime 2 plugin
  • Marmalade, a Emacs plugin
  • +
  • atom-dpaste, a Atom editor plugin
  • {% trans "Statistics" %}

    diff --git a/dpaste/templates/dpaste/base.html b/dpaste/templates/dpaste/base.html index 1f8dc35..a8c7115 100644 --- a/dpaste/templates/dpaste/base.html +++ b/dpaste/templates/dpaste/base.html @@ -19,7 +19,9 @@
  • {% trans "History" %}
  • {% trans "New snippet" %} →
  • -

    {% block headline %}{% endblock %}

    + {% block headline_wrapper %} +

    {% block headline %}{% endblock %}

    + {% endblock %} {% block page %} PAGE MISSING @@ -28,8 +30,10 @@ {% block script_footer %} +