Merge branch 'master' into cleanup

This commit is contained in:
Martin Mahner 2017-01-21 14:45:51 +01:00
commit e1c3d21f38
39 changed files with 588 additions and 372 deletions

View file

@ -6,6 +6,7 @@ omit =
dpaste/south_migrations/*
dpaste/tests/*
dpaste/settings/*
dpaste/wsgi.py
[report]
exclude_lines =

View file

@ -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:

View file

@ -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)
-----------------

View file

@ -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

View file

@ -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',
)

View file

@ -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``

View file

@ -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'),
}

View file

@ -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'),

View file

@ -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 <martin@mahner.org>\n"
"Language-Team: DE <LL@li.org>\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</a>\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."

View file

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View file

@ -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. <leonardocaballero@gmail.com>\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 <a href=\"%(filea_url)s\">#%(filea_id)s</a> y <a href="
"\"%(fileb_url)s\">#%(fileb_id)s</a>"
#: 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."

Binary file not shown.

View file

@ -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 <genghiskhan@gmx.ca>, 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 <genghiskhan@gmx.ca>\n"
"Language-Team: Hebrew <LL@li.org>\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 <a href=\"%(filea_url)s\">#%(filea_id)s</a> and <a href="
"\"%(fileb_url)s\">#%(fileb_id)s</a>\n"
msgstr ""
" הבדל בין <a href=\"%(filea_url)s\">#%(filea_id)s</a> לנגד <a href="
"\"%(fileb_url)s\">#%(fileb_id)s</a>\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 "לא נערכו שינויים בין שני קבצים אלה."

View file

@ -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 <seocam@seocam.com>\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</a>\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."

View file

@ -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()

View file

@ -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 = """<html><body><h1>Access denied</h1>
<p>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.</p>
<p>If you think this is wrong, <a href="https://github.com/bartTC/dpaste">file
a bug on Github please</a>.</p></body></html>"""
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)

View file

@ -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',
),
]

View file

@ -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'])

View file

@ -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',
)

View file

@ -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': '',
}
}

File diff suppressed because one or more lines are too long

View file

@ -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;
}

View file

@ -53,6 +53,7 @@
<li><a href="https://github.com/bartTC/dpasteGUI/wiki">dpasteGUI</a>, a OS X interface</li>
<li><a href="https://github.com/bartTC/SubDpaste">a dpaste Sublime 2 plugin</a></li>
<li><a href="http://marmalade-repo.org/packages/dpaste_de">Marmalade</a>, a Emacs plugin</li>
<li><a href="https://atom.io/packages/atom-dpaste">atom-dpaste</a>, a Atom editor plugin</li>
</ul>
<h3>{% trans "Statistics" %}</h3>

View file

@ -19,7 +19,9 @@
<li class="{% block dpaste_nav_history %}{% endblock %}"><a href="{% url "snippet_history" %}">{% trans "History" %}</a></li>
<li class="{% block dpaste_nav_new %}{% endblock %}"><a href="{% url "snippet_new" %}">{% trans "New snippet" %} &rarr;</a></li>
</ul>
<h3 class="headline"><a href="/">{% block headline %}{% endblock %}</a></h3>
{% block headline_wrapper %}
<h3 class="headline"><a href="{% url "snippet_new" %}">{% block headline %}{% endblock %}</a></h3>
{% endblock %}
</header>
{% block page %}
PAGE MISSING
@ -28,8 +30,10 @@
{% block script_footer %}
<script src="{{ jquery_url }}"></script>
<script src="{% static "dpaste/clipboardjs.min.js" %}"></script>
<script>
jQuery(function($) {
new Clipboard('.clip-button');
$('.autofocus textarea:first').focus();
$('.superenter textarea').on('keydown', function(e){
var metaKey;

View file

@ -1,11 +1,17 @@
{% extends "dpaste/base.html" %}
{% load mptt_tags %}
{% load i18n %}
{% load dpaste_tags %}
{% block title %}{% trans "Snippet" %} #{{ snippet.pk }}{% endblock %}
{% block headline %}{% trans "Snippet" %} #{{ snippet.pk }}{% endblock %}
{% block headline_wrapper %}
<input id="headline-url" class="headline-url" type="text" value="{{ request.build_absolute_uri }}"/>
<button class="btn clip-button headline-url-copy" data-clipboard-target="#headline-url">
<svg width="18" height="24" viewBox="0 0 1024 896" xmlns="http://www.w3.org/2000/svg">
<path d="M128 768h256v64H128v-64z m320-384H128v64h320v-64z m128 192V448L384 640l192 192V704h320V576H576z m-288-64H128v64h160v-64zM128 704h160v-64H128v64z m576 64h64v128c-1 18-7 33-19 45s-27 18-45 19H64c-35 0-64-29-64-64V192c0-35 29-64 64-64h192C256 57 313 0 384 0s128 57 128 128h192c35 0 64 29 64 64v320h-64V320H64v576h640V768zM128 256h512c0-35-29-64-64-64h-64c-35 0-64-29-64-64s-29-64-64-64-64 29-64 64-29 64-64 64h-64c-35 0-64 29-64 64z" />
</svg>
</button>
{% endblock %}
{% block page %}
@ -14,34 +20,9 @@
======================================================================= -->
<div id="snippet-diff" class="snippet-diff container-fluid">
<div class="row-fluid" style="width: auto; padding: 30px 0">
<div class="span9">
<div class="span12">
<div id="diff" style="display:none;"></div>
</div>
<div class="span3">
<form method="get" id="diffform" action="{% url "snippet_diff" %}">
{% csrf_token %}
<div class="tree">
{% for tree_item,structure in tree|tree_info %}
{% if structure.new_level %}<ul><li>{% else %}</li><li>{% endif %}
<div>
<span class="diff">
<input type="radio" name="a" value="{{ tree_item.id }}" {% ifequal tree_item.id snippet.parent_id %}checked="checked"{% endifequal %}>
<input type="radio" name="b" value="{{ tree_item.id }}" {% ifequal snippet tree_item %}checked="checked"{% endifequal %}>
</span>
{% ifequal snippet tree_item %}
<strong>#{{ tree_item.id }}</strong>
{% else %}
<a href="{{ tree_item.get_absolute_url }}">#{{ tree_item.id }}</a>
{% endifequal %}
</div>
{% for level in structure.closed_levels %}</li></ul>{% endfor %}
{% endfor %}
<div class="submit">
<input type="submit" value="{% trans "Compare" %}">
</div>
</div>
</form>
</div>
</div>
</div>
@ -61,8 +42,8 @@
{% if snippet.pk|in_list:request.session.snippet_list %}
<a class="btn" href="{% url "snippet_delete" snippet.secret_id %}" onclick="return confirm('{% trans "Really delete this snippet?" %}');"><i class="icon-trash"></i> {% trans "Delete Now" %}</a>
{% endif %}
{% if not snippet.is_single %}
<a class="btn snippet-diff-trigger" href="#snippet-diff"><i class="icon-search"></i> {% trans "Compare Snippets" %}</a>
{% if snippet.parent %}
<a class="btn snippet-diff-trigger" href="#snippet-diff"><i class="icon-search"></i> {% trans "Compare this Answer" %}</a>
{% endif %}
{% if snippet.expire_type != 3 %}
<a class="btn" href="{% url "snippet_details_raw" snippet.secret_id %}"><i class="icon-align-left"></i> {% trans "View Raw" %}</a>
@ -114,21 +95,15 @@ jQuery(function($) {
$(this).removeClass('snippet-reply-hidden');
});
var curLine = document.location.hash;
{% if snippet.parent %}
/* ------------------------------------------------------------------------
Diff Ajax Call
------------------------------------------------------------------------ */
var diffReq;
$('.snippet-diff-trigger').click(function(e) {
e.preventDefault();
$('#snippet-diff').slideDown('fast');
$('#snippet-diff form').submit();
});
$('#diffform').submit(function() {
var a = $('input[name="a"]:checked').val(),
b = $('input[name="b"]:checked').val();
function fetchDiff() {
var a = {{ snippet.parent.pk }},
b = {{ snippet.pk }};
window.location.hash = 'D' + a + ',' + b;
@ -145,23 +120,20 @@ jQuery(function($) {
}).complete(function() {
diffReq = null;
});
}
return false;
var diffReq;
$('.snippet-diff-trigger').click(function(e) {
e.preventDefault();
fetchDiff();
$('#snippet-diff').slideDown('fast');
});
var curLine = document.location.hash,
hashlist;
if (curLine.substring(0, 2) === '#D') {
hashlist = curLine.substring(2).split(',');
if (hashlist.length === 2) {
console.log(hashlist);
$('#diffform input[name="a"][value="' + hashlist[0] + '"]').prop('checked', true);
$('#diffform input[name="b"][value="' + hashlist[1] + '"]').prop('checked', true);
$('#snippet-diff').slideDown('fast');
$('#snippet-diff form').submit();
}
fetchDiff();
$('#snippet-diff').slideDown('fast');
}
{% endif %}
/* ------------------------------------------------------------------------
Line Highlighting
@ -190,7 +162,7 @@ jQuery(function($) {
});
/* ------------------------------------------------------------------------
Line Highlighting
Wordwrap
------------------------------------------------------------------------ */
$('#toggleWordwrap').click(function(e){
e.preventDefault();

View file

@ -2,7 +2,8 @@
<h4>
{% blocktrans with fileA.get_absolute_url as filea_url and fileB.get_absolute_url as fileb_url and fileA.id as filea_id and fileB.id as fileb_id %}
Diff between <a href="{{ filea_url }}">#{{ filea_id }}</a> and <a href="{{ fileb_url }}">#{{ fileb_id }}</a>
Difference between this answer <a href="{{ fileb_url }}">#{{ fileb_id }}</a>
and the parent snippet <a href="{{ filea_url }}">#{{ filea_id }}</a>
{% endblocktrans %}
</h4>

View file

@ -131,6 +131,12 @@ class SnippetTestCase(TestCase):
self.assertEqual(response.status_code, 404)
self.assertEqual(Snippet.objects.count(), 0)
def test_snippet_notfound(self):
url = reverse('snippet_details', kwargs={'snippet_id': 'abcd'})
response = self.client.get(url, follow=True)
self.assertEqual(response.status_code, 404)
# -------------------------------------------------------------------------
# Reply
# -------------------------------------------------------------------------

View file

@ -1,4 +1,4 @@
from django.conf.urls import patterns, url
from django.conf.urls import url
from ..views import APIView

View file

@ -3,6 +3,7 @@ import difflib
import json
from django.conf import settings
from django import get_version
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db.models import Count
@ -357,8 +358,10 @@ class APIView(View):
# handle them here.
# -----------------------------------------------------------------------------
def page_not_found(request, template_name='dpaste/404.html'):
return django_page_not_found(request, template_name) # pragma: no cover
def page_not_found(request, exception=None, template_name='dpaste/404.html'):
if not exception: # Django <1.8
return django_page_not_found(request, template_name=template_name)
return django_page_not_found(request, exception, template_name=template_name)
def server_error(request, template_name='dpaste/500.html'):
return django_server_error(request, template_name) # pragma: no cover
return django_server_error(request, template_name=template_name) # pragma: no cover

View file

@ -5,8 +5,7 @@
# -----------------------------------------------------------------------------
# Project dependencies
django==1.9.*
django-mptt
django>=1.10
django-markup
pygments
requests
@ -19,7 +18,5 @@ sphinx
sphinx_rtd_theme
# Deployment specific
django-redis==3.8.0
gunicorn==19.1.1
south==1.0.2
gunicorn
psycopg2

View file

@ -25,6 +25,8 @@ SETTINGS = {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'dpaste.context_processors.dpaste_globals',
],
},
},
@ -32,7 +34,6 @@ SETTINGS = {
'INSTALLED_APPS': [
'django.contrib.sessions',
'django.contrib.staticfiles',
'mptt',
'dpaste',
],
'MIDDLEWARE_CLASSES': (
@ -40,7 +41,9 @@ SETTINGS = {
),
'STATIC_ROOT': '/tmp/dpaste_test_static/',
'STATIC_URL': '/static/',
'ROOT_URLCONF': 'dpaste.urls'
'ROOT_URLCONF': 'dpaste.urls',
'LANGUAGE_CODE': 'en',
'LANGUAGES': (('en', 'English'),),
}
def runtests(*test_args):

View file

@ -83,8 +83,8 @@ server {
rewrite ^/(.*)$ https://dpaste.de/$1 permanent;
}
access_log /srv/dpaste.de/var/nginx.access.log combined_port;
error_log /srv/dpaste.de/var/nginx.error.log;
access_log /var/log/nginx/dpaste.access.log combined_port;
error_log /var/log/nginx/dpaste.error.log;
keepalive_timeout 5;
client_max_body_size 10M;

View file

@ -26,7 +26,7 @@
# (bzip2 compressed file), it will be decompressed on the fly as it
# is being read.
LogFile /srv/dpaste.de/var/nginx.access.log
LogFile /var/log/nginx/dpaste.access.log.1
# LogType defines the log type being processed. Normally, the Webalizer
# expects a CLF or Combined web server log as input. Using this option,
@ -64,7 +64,7 @@ OutputDir /srv/dpaste.de/var/webalizer
# with the IncrementalName option below). Please read at least the section
# on Incremental processing in the README file before you enable this option.
#Incremental no
Incremental yes
# IncrementalName allows you to specify the filename for saving the
# incremental data in. It is similar to the HistoryName option where the
@ -73,7 +73,7 @@ OutputDir /srv/dpaste.de/var/webalizer
# kept in the normal output directory. If you don't specify "Incremental"
# as 'yes' then this option has no meaning.
#IncrementalName webalizer.current
IncrementalName webalizer.current
# ReportTitle is the text to display as the title. The hostname
# (unless blank) is appended to the end of this string (separated with

View file

@ -24,7 +24,7 @@ long_description = u'\n\n'.join((
setup(
name='dpaste',
version='2.10',
version='2.13',
description='dpaste is a Django based pastebin. It\'s intended to run '
'separately but its also possible to be installed into an '
'existing Django project like a regular app.',
@ -50,9 +50,7 @@ setup(
include_package_data=True,
install_requires=[
'django>=1.8',
'django-mptt>=0.8.3',
'pygments>=1.6',
'requests>=2.0.0',
'django-markup>=1.0',
],
tests_require=[

View file

@ -1,7 +1,8 @@
[tox]
toxworkdir=/tmp/tox/dpaste
skip_missing_interpreters=True
envlist=
py{27,35}-django-{18,19}
py{27,34,35,36}-django-{18,19,110}
[testenv]
install_command =
@ -12,5 +13,6 @@ commands=
deps=
# Django versions
django-18: django==1.8.*
django-19: django==1.9.*
django-18: django>=1.8,<1.9
django-19: django>=1.9,<1.10
django-110: django>=1.10,<1.11