From 2a1841ac563f2f14bcf8808bcec21902d5eeecd2 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Mon, 12 Mar 2018 11:59:38 +0100 Subject: [PATCH] Full metal cleanup --- .travis.yml | 3 +- CHANGELOG | 2 + Pipfile | 14 +- Pipfile.lock | 322 +++++++++++------- docs/conf.py | 9 +- docs/installation.rst | 23 +- docs/integration.rst | 6 +- dpaste/__init__.py | 1 + dpaste/apps.py | 8 + dpaste/migrations/0001_initial.py | 2 +- dpaste/models.py | 5 +- dpaste/settings/base.py | 14 +- dpaste/settings/tests.py | 5 + dpaste/south_migrations/0001_initial.py | 70 ---- ...snippet_author__del_field_snippet_title.py | 57 ---- ...__del_field_snippet_content_highlighted.py | 40 --- ...__chg_field_snippet_secret_id__chg_fiel.py | 50 --- ...pire_type__add_field_snippet_view_count.py | 50 --- ...0006_auto__add_unique_snippet_secret_id.py | 40 --- dpaste/south_migrations/__init__.py | 0 dpaste/tests/test_api.py | 2 +- dpaste/tests/test_highlight.py | 14 + dpaste/tests/test_snippet.py | 2 +- dpaste/views.py | 2 +- runtests.py | 62 +--- setup.py | 17 +- tox.ini | 27 +- 27 files changed, 295 insertions(+), 552 deletions(-) create mode 100644 dpaste/apps.py create mode 100644 dpaste/settings/tests.py delete mode 100644 dpaste/south_migrations/0001_initial.py delete mode 100644 dpaste/south_migrations/0002_auto__del_spamword__del_field_snippet_author__del_field_snippet_title.py delete mode 100644 dpaste/south_migrations/0003_auto__del_field_snippet_content_highlighted.py delete mode 100644 dpaste/south_migrations/0004_auto__chg_field_snippet_expires__chg_field_snippet_secret_id__chg_fiel.py delete mode 100644 dpaste/south_migrations/0005_auto__add_field_snippet_expire_type__add_field_snippet_view_count.py delete mode 100644 dpaste/south_migrations/0006_auto__add_unique_snippet_secret_id.py delete mode 100644 dpaste/south_migrations/__init__.py create mode 100644 dpaste/tests/test_highlight.py diff --git a/.travis.yml b/.travis.yml index 9827095..44ded2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,8 @@ env: - DJANGO: django>=1.8,<1.9 - DJANGO: django>=1.9,<1.10 - DJANGO: django>=1.10,<1.11 - - DJANGO: django>=1.11,<1.12 + - DJANGO: django>=1.11,<2.0 + - DJANGO: django>=2.0 before_install: - pip install codecov diff --git a/CHANGELOG b/CHANGELOG index 5d8facb..592a318 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,8 @@ Changelog 3.0 (master) ------------- +* Dropped support for Django 1.8 to 1.10 due to it's general end of support. + The project will likely work well but it's no longer specifically tested. * General code cleanup * Removed jQuery, all Javascript is native. * Removed Bootstrap for theming. diff --git a/Pipfile b/Pipfile index 5c9a761..9e8405a 100644 --- a/Pipfile +++ b/Pipfile @@ -7,21 +7,11 @@ name = "pypi" [dev-packages] -docutils = "*" sphinx-rtd-theme = "*" sphinx = "*" -"psycopg2" = "*" +"e1839a8" = {path = ".", extras = ["standalone"], editable = true} [packages] -django = ">=1.8,<2.0" -pygments = ">=1.6" -django-markup = ">=1.0" -django-sslserver = "*" -django-csp = "==3.3" - - -[requires] - -python_version = "3.6" +pylint = "*" diff --git a/Pipfile.lock b/Pipfile.lock index f6c95be..9f58be9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,25 +1,10 @@ { "_meta": { "hash": { - "sha256": "0549fbbea19d5c6906d2c16e5fa3561f428a7a4a4db5d841b41e9fb7cd0dba44" - }, - "host-environment-markers": { - "implementation_name": "cpython", - "implementation_version": "3.6.2", - "os_name": "posix", - "platform_machine": "x86_64", - "platform_python_implementation": "CPython", - "platform_release": "17.3.0", - "platform_system": "Darwin", - "platform_version": "Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64", - "python_full_version": "3.6.2", - "python_version": "3.6", - "sys_platform": "darwin" + "sha256": "bc3ecc152b070bbc2053c9b147a2b1c66c062997c87b8b7086d0de37efd9407d" }, "pipfile-spec": 6, - "requires": { - "python_version": "3.6" - }, + "requires": {}, "sources": [ { "name": "pypi", @@ -29,59 +14,81 @@ ] }, "default": { - "django": { + "astroid": { "hashes": [ - "sha256:90952c46d2b7b042db00e98b05f5dd97a5775822948d46fd82ff074d8ac75853", - "sha256:353d129f22e1d24980d6061666f435781141c2dfd852f14ffc8a670175821034" + "sha256:db5cfc9af6e0b60cd07c19478fb54021fc20d2d189882fbcbc94fc69a8aecc58", + "sha256:f0a0e386dbca9f93ea9f3ea6f32b37a24720502b7baa9cb17c3976a680d43a06" ], - "version": "==1.11.9" + "version": "==1.6.1" }, - "django-csp": { + "isort": { "hashes": [ - "sha256:a95eeeb04df155b6270612238700f16abd2b0cc3d32dbcfca8c7fd06d26dacba", - "sha256:db082b75075672fb9cf4a622c75c94ee624cb566ffe9d2a645687e58598b6d39" + "sha256:1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af", + "sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8", + "sha256:ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497" ], - "version": "==3.3" + "version": "==4.3.4" }, - "django-markup": { + "lazy-object-proxy": { "hashes": [ - "sha256:4ef5d268d9376253513f3a7897ac15da48795412b34c8c9c4b9ef0a472ff21b7" + "sha256:0ce34342b419bd8f018e6666bfef729aec3edf62345a53b537a4dcc115746a33", + "sha256:1b668120716eb7ee21d8a38815e5eb3bb8211117d9a90b0f8e21722c0758cc39", + "sha256:209615b0fe4624d79e50220ce3310ca1a9445fd8e6d3572a896e7f9146bbf019", + "sha256:27bf62cb2b1a2068d443ff7097ee33393f8483b570b475db8ebf7e1cba64f088", + "sha256:27ea6fd1c02dcc78172a82fc37fcc0992a94e4cecf53cb6d73f11749825bd98b", + "sha256:2c1b21b44ac9beb0fc848d3993924147ba45c4ebc24be19825e57aabbe74a99e", + "sha256:2df72ab12046a3496a92476020a1a0abf78b2a7db9ff4dc2036b8dd980203ae6", + "sha256:320ffd3de9699d3892048baee45ebfbbf9388a7d65d832d7e580243ade426d2b", + "sha256:50e3b9a464d5d08cc5227413db0d1c4707b6172e4d4d915c1c70e4de0bbff1f5", + "sha256:5276db7ff62bb7b52f77f1f51ed58850e315154249aceb42e7f4c611f0f847ff", + "sha256:61a6cf00dcb1a7f0c773ed4acc509cb636af2d6337a08f362413c76b2b47a8dd", + "sha256:6ae6c4cb59f199d8827c5a07546b2ab7e85d262acaccaacd49b62f53f7c456f7", + "sha256:7661d401d60d8bf15bb5da39e4dd72f5d764c5aff5a86ef52a042506e3e970ff", + "sha256:7bd527f36a605c914efca5d3d014170b2cb184723e423d26b1fb2fd9108e264d", + "sha256:7cb54db3535c8686ea12e9535eb087d32421184eacc6939ef15ef50f83a5e7e2", + "sha256:7f3a2d740291f7f2c111d86a1c4851b70fb000a6c8883a59660d95ad57b9df35", + "sha256:81304b7d8e9c824d058087dcb89144842c8e0dea6d281c031f59f0acf66963d4", + "sha256:933947e8b4fbe617a51528b09851685138b49d511af0b6c0da2539115d6d4514", + "sha256:94223d7f060301b3a8c09c9b3bc3294b56b2188e7d8179c762a1cda72c979252", + "sha256:ab3ca49afcb47058393b0122428358d2fbe0408cf99f1b58b295cfeb4ed39109", + "sha256:bd6292f565ca46dee4e737ebcc20742e3b5be2b01556dafe169f6c65d088875f", + "sha256:cb924aa3e4a3fb644d0c463cad5bc2572649a6a3f68a7f8e4fbe44aaa6d77e4c", + "sha256:d0fc7a286feac9077ec52a927fc9fe8fe2fabab95426722be4c953c9a8bede92", + "sha256:ddc34786490a6e4ec0a855d401034cbd1242ef186c20d79d2166d6a4bd449577", + "sha256:e34b155e36fa9da7e1b7c738ed7767fc9491a62ec6af70fe9da4a057759edc2d", + "sha256:e5b9e8f6bda48460b7b143c3821b21b452cb3a835e6bbd5dd33aa0c8d3f5137d", + "sha256:e81ebf6c5ee9684be8f2c87563880f93eedd56dd2b6146d8a725b50b7e5adb0f", + "sha256:eb91be369f945f10d3a49f5f9be8b3d0b93a4c2be8f8a5b83b0571b8123e0a7a", + "sha256:f460d1ceb0e4a5dcb2a652db0904224f367c9b3c1470d5a7683c0480e582468b" ], - "version": "==1.2" + "version": "==1.3.1" }, - "django-sslserver": { + "mccabe": { "hashes": [ - "sha256:6b2514427b4eed0713e478ae6dfdda622070a98f657d61a4502bf42b6311c66e" + "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", + "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" ], - "version": "==0.20" + "version": "==0.6.1" }, - "pygments": { + "pylint": { "hashes": [ - "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", - "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + "sha256:156839bedaa798febee72893beef00c650c2e7abafb5586fc7a6a56be7f80412", + "sha256:4fe3b99da7e789545327b75548cee6b511e4faa98afe268130fea1af4b5ec022" ], - "version": "==2.2.0" - }, - "pytz": { - "hashes": [ - "sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48", - "sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d", - "sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33", - "sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027", - "sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a", - "sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94", - "sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7", - "sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82", - "sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7" - ], - "version": "==2017.3" + "version": "==1.8.2" }, "six": { "hashes": [ - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" ], "version": "==1.11.0" + }, + "wrapt": { + "hashes": [ + "sha256:d4d560d479f2c21e1b5443bbd15fe7ec4b37fe7e53d335d3b9b0a7b1226fe3c6" + ], + "version": "==1.10.11" } }, "develop": { @@ -94,46 +101,108 @@ }, "babel": { "hashes": [ - "sha256:f20b2acd44f587988ff185d8949c3e208b4b3d5d20fcab7d91fe481ffa435528", - "sha256:6007daf714d0cd5524bbe436e2d42b3c20e68da66289559341e48d2cd6d25811" + "sha256:8ce4cb6fdd4393edd323227cba3a077bceb2a6ce5201c902c65e730046f41f14", + "sha256:ad209a68d7162c4cff4b29cdebe3dec4cef75492df501b0049a9433c96ce6f80" ], - "version": "==2.5.1" + "version": "==2.5.3" }, "certifi": { "hashes": [ - "sha256:244be0d93b71e93fc0a0a479862051414d0e00e16435707e5bf5000f92e04694", - "sha256:5ec74291ca1136b40f0379e1128ff80e866597e4e2c1e755739a913bbc3613c0" + "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", + "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" ], - "version": "==2017.11.5" + "version": "==2018.1.18" }, "chardet": { "hashes": [ - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691", - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" ], "version": "==3.0.4" }, + "coverage": { + "hashes": [ + "sha256:03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba", + "sha256:0b136648de27201056c1869a6c0d4e23f464750fd9a9ba9750b8336a244429ed", + "sha256:104ab3934abaf5be871a583541e8829d6c19ce7bde2923b2751e0d3ca44db60a", + "sha256:15b111b6a0f46ee1a485414a52a7ad1d703bdf984e9ed3c288a4414d3871dcbd", + "sha256:198626739a79b09fa0a2f06e083ffd12eb55449b5f8bfdbeed1df4910b2ca640", + "sha256:1c383d2ef13ade2acc636556fd544dba6e14fa30755f26812f54300e401f98f2", + "sha256:28b2191e7283f4f3568962e373b47ef7f0392993bb6660d079c62bd50fe9d162", + "sha256:2eb564bbf7816a9d68dd3369a510be3327f1c618d2357fa6b1216994c2e3d508", + "sha256:337ded681dd2ef9ca04ef5d93cfc87e52e09db2594c296b4a0a3662cb1b41249", + "sha256:3a2184c6d797a125dca8367878d3b9a178b6fdd05fdc2d35d758c3006a1cd694", + "sha256:3c79a6f7b95751cdebcd9037e4d06f8d5a9b60e4ed0cd231342aa8ad7124882a", + "sha256:3d72c20bd105022d29b14a7d628462ebdc61de2f303322c0212a054352f3b287", + "sha256:3eb42bf89a6be7deb64116dd1cc4b08171734d721e7a7e57ad64cc4ef29ed2f1", + "sha256:4635a184d0bbe537aa185a34193898eee409332a8ccb27eea36f262566585000", + "sha256:56e448f051a201c5ebbaa86a5efd0ca90d327204d8b059ab25ad0f35fbfd79f1", + "sha256:5a13ea7911ff5e1796b6d5e4fbbf6952381a611209b736d48e675c2756f3f74e", + "sha256:69bf008a06b76619d3c3f3b1983f5145c75a305a0fea513aca094cae5c40a8f5", + "sha256:6bc583dc18d5979dc0f6cec26a8603129de0304d5ae1f17e57a12834e7235062", + "sha256:701cd6093d63e6b8ad7009d8a92425428bc4d6e7ab8d75efbb665c806c1d79ba", + "sha256:7608a3dd5d73cb06c531b8925e0ef8d3de31fed2544a7de6c63960a1e73ea4bc", + "sha256:76ecd006d1d8f739430ec50cc872889af1f9c1b6b8f48e29941814b09b0fd3cc", + "sha256:7aa36d2b844a3e4a4b356708d79fd2c260281a7390d678a10b91ca595ddc9e99", + "sha256:7d3f553904b0c5c016d1dad058a7554c7ac4c91a789fca496e7d8347ad040653", + "sha256:7e1fe19bd6dce69d9fd159d8e4a80a8f52101380d5d3a4d374b6d3eae0e5de9c", + "sha256:8c3cb8c35ec4d9506979b4cf90ee9918bc2e49f84189d9bf5c36c0c1119c6558", + "sha256:9d6dd10d49e01571bf6e147d3b505141ffc093a06756c60b053a859cb2128b1f", + "sha256:9e112fcbe0148a6fa4f0a02e8d58e94470fc6cb82a5481618fea901699bf34c4", + "sha256:ac4fef68da01116a5c117eba4dd46f2e06847a497de5ed1d64bb99a5fda1ef91", + "sha256:b8815995e050764c8610dbc82641807d196927c3dbed207f0a079833ffcf588d", + "sha256:be6cfcd8053d13f5f5eeb284aa8a814220c3da1b0078fa859011c7fffd86dab9", + "sha256:c1bb572fab8208c400adaf06a8133ac0712179a334c09224fb11393e920abcdd", + "sha256:de4418dadaa1c01d497e539210cb6baa015965526ff5afc078c57ca69160108d", + "sha256:e05cb4d9aad6233d67e0541caa7e511fa4047ed7750ec2510d466e806e0255d6", + "sha256:e4d96c07229f58cb686120f168276e434660e4358cc9cf3b0464210b04913e77", + "sha256:f3f501f345f24383c0000395b26b726e46758b71393267aeae0bd36f8b3ade80", + "sha256:f8a923a85cb099422ad5a2e345fe877bbc89a8a8b23235824a93488150e45f6e" + ], + "version": "==4.5.1" + }, + "django": { + "hashes": [ + "sha256:3d9916515599f757043c690ae2b5ea28666afa09779636351da505396cbb2f19", + "sha256:769f212ffd5762f72c764fa648fca3b7f7dd4ec27407198b68e7c4abf4609fd0" + ], + "version": "==2.0.3" + }, + "django-csp": { + "hashes": [ + "sha256:a95eeeb04df155b6270612238700f16abd2b0cc3d32dbcfca8c7fd06d26dacba", + "sha256:db082b75075672fb9cf4a622c75c94ee624cb566ffe9d2a645687e58598b6d39" + ], + "version": "==3.3" + }, "docutils": { "hashes": [ - "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6", "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", - "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274" + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" ], "version": "==0.14" }, + "e1839a8": { + "editable": true, + "extras": [ + "standalone" + ], + "path": "." + }, "idna": { "hashes": [ - "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4", - "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f" + "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f", + "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4" ], "version": "==2.6" }, "imagesize": { "hashes": [ - "sha256:6ebdc9e0ad188f9d1b2cdd9bc59cbe42bf931875e829e7a595e6b3abdc05cdfb", - "sha256:0ab2c62b87987e3252f89d30b7cedbec12a01af9274af9ffa48108f2c13c6062" + "sha256:3620cc0cadba3f7475f9940d22431fc4d407269f1be59ec9b8edcca26440cf18", + "sha256:5b326e4678b6925158ccc66a9fa3122b6106d7c876ee32d7de6ce59385b96315" ], - "version": "==0.7.1" + "version": "==1.0.0" }, "jinja2": { "hashes": [ @@ -148,41 +217,25 @@ ], "version": "==1.0" }, - "psycopg2": { + "packaging": { "hashes": [ - "sha256:594aa9a095de16614f703d759e10c018bdffeafce2921b8e80a0e8a0ebbc12e5", - "sha256:1cf5d84290c771eeecb734abe2c6c3120e9837eb12f99474141a862b9061ac51", - "sha256:0344b181e1aea37a58c218ccb0f0f771295de9aa25a625ed076e6996c6530f9e", - "sha256:25250867a4cd1510fb755ef9cb38da3065def999d8e92c44e49a39b9b76bc893", - "sha256:317612d5d0ca4a9f7e42afb2add69b10be360784d21ce4ecfbca19f1f5eadf43", - "sha256:9d6266348b15b4a48623bf4d3e50445d8e581da413644f365805b321703d0fac", - "sha256:ddca39cc55877653b5fcf59976d073e3d58c7c406ef54ae8e61ddf8782867182", - "sha256:988d2ec7560d42ef0ac34b3b97aad14c4f068792f00e1524fa1d3749fe4e4b64", - "sha256:7a9c6c62e6e05df5406e9b5235c31c376a22620ef26715a663cee57083b3c2ea", - "sha256:7a75565181e75ba0b9fb174b58172bf6ea9b4331631cfe7bafff03f3641f5d73", - "sha256:94e4128ba1ea56f02522fffac65520091a9de3f5c00da31539e085e13db4771b", - "sha256:92179bd68c2efe72924a99b6745a9172471931fc296f9bfdf9645b75eebd6344", - "sha256:b9358e203168fef7bfe9f430afaed3a2a624717a1d19c7afa7dfcbd76e3cd95c", - "sha256:009e0bc09a57dbef4b601cb8b46a2abad51f5274c8be4bba276ff2884cd4cc53", - "sha256:d3ac07240e2304181ffdb13c099840b5eb555efc7be9344503c0c03aa681de79", - "sha256:40fa5630cd7d237cd93c4d4b64b9e5ed9273d1cfce55241c7f9066f5db70629d", - "sha256:6c2f1a76a9ebd9ecf7825b9e20860139ca502c2bf1beabf6accf6c9e66a7e0c3", - "sha256:37f54452c7787dbdc0a634ca9773362b91709917f0b365ed14b831f03cbd34ba", - "sha256:8f5942a4daf1ffac42109dc4a72f786af4baa4fa702ede1d7c57b4b696c2e7d6", - "sha256:bf708455cd1e9fa96c05126e89a0c59b200d086c7df7bbafc7d9be769e4149a3", - "sha256:82c40ea3ac1555e0462803380609fbe8b26f52620f3d4f8eb480cfd8ceed8a14", - "sha256:207ba4f9125a0a4200691e82d5eee7ea1485708eabe99a07fc7f08696fae62f4", - "sha256:0cd4c848f0e9d805d531e44973c8f48962e20eb7fc0edac3db4f9dbf9ed5ab82", - "sha256:57baf63aeb2965ca4b52613ce78e968b6d2bde700c97f6a7e8c6c236b51ab83e", - "sha256:2954557393cfc9a5c11a5199c7a78cd9c0c793a047552d27b1636da50d013916", - "sha256:7c31dade89634807196a6b20ced831fbd5bec8a21c4e458ea950c9102c3aa96f", - "sha256:1286dd16d0e46d59fa54582725986704a7a3f3d9aca6c5902a7eceb10c60cb7e", - "sha256:697ff63bc5451e0b0db48ad205151123d25683b3754198be7ab5fcb44334e519", - "sha256:fc993c9331d91766d54757bbc70231e29d5ceb2d1ac08b1570feaa0c38ab9582", - "sha256:9d64fed2681552ed642e9c0cc831a9e95ab91de72b47d0cb68b5bf506ba88647", - "sha256:5c3213be557d0468f9df8fe2487eaf2990d9799202c5ff5cb8d394d09fad9b2a" + "sha256:e9215d2d2535d3ae866c3d6efc77d5b24a0192cce0ff20e42896cc0664f889c0", + "sha256:f019b770dd64e585a99714f1fd5e01c7a8f11b45635aa953fd41c689a657375b" ], - "version": "==2.7.3.2" + "version": "==17.1" + }, + "pluggy": { + "hashes": [ + "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff" + ], + "version": "==0.6.0" + }, + "py": { + "hashes": [ + "sha256:8cca5c229d225f8c1e3085be4fcf306090b00850fefad892f9d96c7b6e2f310f", + "sha256:ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d" + ], + "version": "==1.5.2" }, "pygments": { "hashes": [ @@ -191,19 +244,31 @@ ], "version": "==2.2.0" }, + "pyparsing": { + "hashes": [ + "sha256:0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04", + "sha256:281683241b25fe9b80ec9d66017485f6deff1af5cde372469134b56ca8447a07", + "sha256:8f1e18d3fd36c6795bb7e02a39fd05c611ffc2596c1e0d995d34d67630426c18", + "sha256:9e8143a3e15c13713506886badd96ca4b579a87fbdf49e550dbfc057d6cb218e", + "sha256:b8b3117ed9bdf45e14dcc89345ce638ec7e0e29b2b579fa1ecf32ce45ebac8a5", + "sha256:e4d45427c6e20a59bf4f88c639dcc03ce30d193112047f94012102f235853a58", + "sha256:fee43f17a9c4087e7ed1605bd6df994c6173c1e977d7ade7b651292fab2bd010" + ], + "version": "==2.2.0" + }, "pytz": { "hashes": [ - "sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48", - "sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d", - "sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33", - "sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027", - "sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a", - "sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94", - "sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7", - "sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82", - "sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7" + "sha256:07edfc3d4d2705a20a6e99d97f0c4b61c800b8232dc1c04d87e8554f130148dd", + "sha256:3a47ff71597f821cd84a162e71593004286e5be07a340fd462f0d33a760782b5", + "sha256:410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0", + "sha256:5bd55c744e6feaa4d599a6cbd8228b4f8f9ba96de2c38d56f08e534b3c9edf0d", + "sha256:61242a9abc626379574a166dc0e96a66cd7c3b27fc10868003fa210be4bff1c9", + "sha256:887ab5e5b32e4d0c86efddd3d055c1f363cbaa583beb8da5e22d2fa2f64d51ef", + "sha256:ba18e6a243b3625513d85239b3e49055a2f0318466e0b8a92b8fb8ca7ccdf55f", + "sha256:ed6509d9af298b7995d69a440e2822288f2eca1681b8cce37673dbb10091e5fe", + "sha256:f93ddcdd6342f94cea379c73cddb5724e0d6d0a1c91c9bdef364dc0368ba4fda" ], - "version": "==2017.3" + "version": "==2018.3" }, "requests": { "hashes": [ @@ -214,47 +279,45 @@ }, "six": { "hashes": [ - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" ], "version": "==1.11.0" }, "snowballstemmer": { "hashes": [ - "sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89", - "sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128" + "sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128", + "sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89" ], "version": "==1.2.1" }, "sphinx": { "hashes": [ - "sha256:fdf77f4f30d84a314c797d67fe7d1b46665e6c48a25699d7bf0610e05a2221d4", - "sha256:c6de5dbdbb7a0d7d2757f4389cc00e8f6eb3c49e1772378967a12cfcf2cfe098" + "sha256:41ae26acc6130ccf6ed47e5cca73742b80d55a134f0ab897c479bba8d3640b8e", + "sha256:da987de5fcca21a4acc7f67a86a363039e67ac3e8827161e61b91deb131c0ee8" ], - "version": "==1.6.5" + "version": "==1.7.1" }, "sphinx-rtd-theme": { "hashes": [ - "sha256:62ee4752716e698bad7de8a18906f42d33664128eea06c46b718fc7fbd1a9f5c", - "sha256:2df74b8ff6fae6965c527e97cca6c6c944886aae474b490e17f92adfbe843417" + "sha256:2df74b8ff6fae6965c527e97cca6c6c944886aae474b490e17f92adfbe843417", + "sha256:62ee4752716e698bad7de8a18906f42d33664128eea06c46b718fc7fbd1a9f5c" ], "version": "==0.2.4" }, "sphinxcontrib-websupport": { "hashes": [ - "sha256:f4932e95869599b89bf4f80fc3989132d83c9faa5bf633e7b5e0c25dffb75da2", - "sha256:7a85961326aa3a400cd4ad3c816d70ed6f7c740acd7ce5d78cd0a67825072eb9" + "sha256:7a85961326aa3a400cd4ad3c816d70ed6f7c740acd7ce5d78cd0a67825072eb9", + "sha256:f4932e95869599b89bf4f80fc3989132d83c9faa5bf633e7b5e0c25dffb75da2" ], "version": "==1.0.1" }, - "typing": { + "tox": { "hashes": [ - "sha256:349b1f9c109c84b53ac79ac1d822eaa68fc91d63b321bd9392df15098f746f53", - "sha256:63a8255fe7c6269916baa440eb9b6a67139b0b97a01af632e7bd2842e1e02f15", - "sha256:d514bd84b284dd3e844f0305ac07511f097e325171f6cc4a20878d11ad771849" + "sha256:752f5ec561c6c08c5ecb167d3b20f4f4ffc158c0ab78855701a75f5cef05f4b8", + "sha256:8af30fd835a11f3ff8e95176ccba5a4e60779df4d96a9dfefa1a1704af263225" ], - "markers": "python_version < '3.5'", - "version": "==3.6.2" + "version": "==2.9.1" }, "urllib3": { "hashes": [ @@ -262,6 +325,13 @@ "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" ], "version": "==1.22" + }, + "virtualenv": { + "hashes": [ + "sha256:02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a", + "sha256:39d88b533b422825d644087a21e78c45cf5af0ef7a99a1fc9fbb7b481e5c85b0" + ], + "version": "==15.1.0" } } } diff --git a/docs/conf.py b/docs/conf.py index 4f47c3b..689788d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ # # All configuration values have a default; values that are commented out # serve to show the default. -#import sys +import sys import os # If extensions (or modules to document with autodoc) are in another directory, @@ -95,11 +95,14 @@ pygments_style = 'sphinx' # -- Options for HTML output ---------------------------------------------- -if os.environ.get('READTHEDOCS', None) == 'True': +try: import sphinx_rtd_theme html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - +except ImportError: + sys.stderr.write('Sphinx "rtd" theme is not installed.' + 'Fallback to regular theme.') + # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'default' diff --git a/docs/installation.rst b/docs/installation.rst index cd9ed70..c4d11de 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -2,28 +2,25 @@ Installation for local development ================================== -Ready to contribute? Here's how to set up `dpaste` for local development. +Local development is done with `pipenv`_ to maintain packages. -1. Fork the `dpaste` repo on GitHub. -2. Clone your fork locally:: - - $ git clone https://github.com//dpaste.git - -3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper -installed, this is how you set up your fork for local development:: +Installation:: $ cd dpaste/ $ pipenv install --three --dev -4. Copy the settings file and edit it, to meet your needs:: +Copy the settings file and edit it, to meet your needs:: $ cp dpaste/settings/local.py.example dpaste/settings/local.py $ nano dpaste/settings/local.py -5. Initialze the database by running the command:: +Run the testsuite:: + + $ pipenv run ./runtests.py + +To run the project on your local machine:: $ pipenv run ./manage.py migrate - -6. Start up the webserver:: - $ pipenv run ./manage.py runserver + +.. _pipenv: https://docs.pipenv.org/ diff --git a/docs/integration.rst b/docs/integration.rst index c89dc9f..20e2978 100644 --- a/docs/integration.rst +++ b/docs/integration.rst @@ -2,7 +2,7 @@ Integrate dpaste into an existing project ========================================= -Dpaste needs at least Django 1.4+ and is tested on Python 2.7 as well as +Dpaste needs at least Django 1.11+ and is tested on Python 2.7 as well as Python 3.3. Install the latest dpaste release in your environment. This will install all @@ -10,13 +10,13 @@ necessary dependencies of dpaste as well:: pip install dpaste -Add ``dpaste`` to your ``INSTALLED_APPS``:: +Add ``dpaste.apps.dpasteAppConfig`` to your ``INSTALLED_APPS``:: INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.staticfiles', # ... - 'dpaste', + 'dpaste.apps.dpasteAppConfig', ) Add ``dpaste`` — and if you want — the ``dpaste_api`` to your urlpatterns:: diff --git a/dpaste/__init__.py b/dpaste/__init__.py index e69de29..c31edf7 100644 --- a/dpaste/__init__.py +++ b/dpaste/__init__.py @@ -0,0 +1 @@ +default_app_config = 'dpaste.apps.dpasteAppConfig' diff --git a/dpaste/apps.py b/dpaste/apps.py new file mode 100644 index 0000000..6b95ca5 --- /dev/null +++ b/dpaste/apps.py @@ -0,0 +1,8 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class dpasteAppConfig(AppConfig): + name = 'dpaste' + verbose_name = 'dpaste' diff --git a/dpaste/migrations/0001_initial.py b/dpaste/migrations/0001_initial.py index 5bf120f..5640c22 100644 --- a/dpaste/migrations/0001_initial.py +++ b/dpaste/migrations/0001_initial.py @@ -25,7 +25,7 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False, db_index=True)), ('tree_id', models.PositiveIntegerField(editable=False, db_index=True)), ('level', models.PositiveIntegerField(editable=False, db_index=True)), - ('parent', models.ForeignKey(related_name='children', blank=True, to='dpaste.Snippet', null=True)), + ('parent', models.ForeignKey(related_name='children', blank=True, to='dpaste.Snippet', null=True, on_delete=models.CASCADE)), ], options={ 'ordering': ('-published',), diff --git a/dpaste/models.py b/dpaste/models.py index 7cc2a37..4a54151 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from random import SystemRandom from django.conf import settings -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import models from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ @@ -53,7 +53,8 @@ class Snippet(models.Model): choices=EXPIRE_CHOICES, default=EXPIRE_CHOICES[0][0]) expires = models.DateTimeField(_(u'Expires'), blank=True, null=True) view_count = models.PositiveIntegerField(_('View count'), default=0) - parent = models.ForeignKey('self', null=True, blank=True, related_name='children') + parent = models.ForeignKey('self', null=True, blank=True, + related_name='children', on_delete=models.CASCADE) class Meta: ordering = ('-published',) diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index c608794..eda5ad3 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -40,15 +40,7 @@ SITE_ID = 1 # Make this unique, and don't share it with anybody. SECRET_KEY = '' -ALLOWED_HOSTS = ( - 'dpaste.de', - 'www.dpaste.de', - 'dpaste.org', - 'www.dpaste.org', - '127.0.0.1', -) - -SECRET_KEY = 'CHANGE_ME' +ALLOWED_HOSTS = ['*'] #============================================================================== # I18N @@ -88,7 +80,7 @@ LOGIN_REDIRECT_URL = '/' # Templates #============================================================================== -MIDDLEWARE_CLASSES = [ +MIDDLEWARE = [ 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -116,7 +108,7 @@ TEMPLATES = [ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django.contrib.sessions', - 'dpaste', + 'dpaste.apps.dpasteAppConfig', ) DATABASES = { diff --git a/dpaste/settings/tests.py b/dpaste/settings/tests.py new file mode 100644 index 0000000..c8e3d5d --- /dev/null +++ b/dpaste/settings/tests.py @@ -0,0 +1,5 @@ +""" +Settings for the test suite +""" + +from .base import * diff --git a/dpaste/south_migrations/0001_initial.py b/dpaste/south_migrations/0001_initial.py deleted file mode 100644 index 869fb7c..0000000 --- a/dpaste/south_migrations/0001_initial.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Snippet' - db.create_table('dpaste_snippet', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('secret_id', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)), - ('author', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)), - ('content', self.gf('django.db.models.fields.TextField')()), - ('content_highlighted', self.gf('django.db.models.fields.TextField')(blank=True)), - ('lexer', self.gf('django.db.models.fields.CharField')(default='python', max_length=30)), - ('published', self.gf('django.db.models.fields.DateTimeField')(blank=True)), - ('expires', self.gf('django.db.models.fields.DateTimeField')(blank=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['dpaste.Snippet'])), - ('lft', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)), - ('rght', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)), - ('tree_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)), - ('level', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)), - )) - db.send_create_signal('dpaste', ['Snippet']) - - # Adding model 'Spamword' - db.create_table('dpaste_spamword', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('word', self.gf('django.db.models.fields.CharField')(max_length=100)), - )) - db.send_create_signal('dpaste', ['Spamword']) - - def backwards(self, orm): - # Deleting model 'Snippet' - db.delete_table('dpaste_snippet') - - # Deleting model 'Spamword' - db.delete_table('dpaste_spamword') - - models = { - 'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'content': ('django.db.models.fields.TextField', [], {}), - 'content_highlighted': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}), - 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), - 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - }, - 'dpaste.spamword': { - 'Meta': {'object_name': 'Spamword'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'word': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/0002_auto__del_spamword__del_field_snippet_author__del_field_snippet_title.py b/dpaste/south_migrations/0002_auto__del_spamword__del_field_snippet_author__del_field_snippet_title.py deleted file mode 100644 index 4e483b8..0000000 --- a/dpaste/south_migrations/0002_auto__del_spamword__del_field_snippet_author__del_field_snippet_title.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting model 'Spamword' - db.delete_table('dpaste_spamword') - - # Deleting field 'Snippet.author' - db.delete_column('dpaste_snippet', 'author') - - # Deleting field 'Snippet.title' - db.delete_column('dpaste_snippet', 'title') - - def backwards(self, orm): - # Adding model 'Spamword' - db.create_table('dpaste_spamword', ( - ('word', self.gf('django.db.models.fields.CharField')(max_length=100)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - )) - db.send_create_signal('dpaste', ['Spamword']) - - # Adding field 'Snippet.author' - db.add_column('dpaste_snippet', 'author', - self.gf('django.db.models.fields.CharField')(default='', max_length=30, blank=True), - keep_default=False) - - # Adding field 'Snippet.title' - db.add_column('dpaste_snippet', 'title', - self.gf('django.db.models.fields.CharField')(default='', max_length=120, blank=True), - keep_default=False) - - models = { - 'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'content': ('django.db.models.fields.TextField', [], {}), - 'content_highlighted': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}), - 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/0003_auto__del_field_snippet_content_highlighted.py b/dpaste/south_migrations/0003_auto__del_field_snippet_content_highlighted.py deleted file mode 100644 index 4d72cea..0000000 --- a/dpaste/south_migrations/0003_auto__del_field_snippet_content_highlighted.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'Snippet.content_highlighted' - db.delete_column(u'dpaste_snippet', 'content_highlighted') - - - def backwards(self, orm): - # Adding field 'Snippet.content_highlighted' - db.add_column(u'dpaste_snippet', 'content_highlighted', - self.gf('django.db.models.fields.TextField')(default='', blank=True), - keep_default=False) - - - models = { - u'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'content': ('django.db.models.fields.TextField', [], {}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'Python'", 'max_length': '30'}), - 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': u"orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), - 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/0004_auto__chg_field_snippet_expires__chg_field_snippet_secret_id__chg_fiel.py b/dpaste/south_migrations/0004_auto__chg_field_snippet_expires__chg_field_snippet_secret_id__chg_fiel.py deleted file mode 100644 index ae2bd24..0000000 --- a/dpaste/south_migrations/0004_auto__chg_field_snippet_expires__chg_field_snippet_secret_id__chg_fiel.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Snippet.expires' - db.alter_column('dpaste_snippet', 'expires', self.gf('django.db.models.fields.DateTimeField')(null=True)) - - # Changing field 'Snippet.secret_id' - db.alter_column('dpaste_snippet', 'secret_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) - - # Changing field 'Snippet.published' - db.alter_column('dpaste_snippet', 'published', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True)) - - def backwards(self, orm): - - # Changing field 'Snippet.expires' - db.alter_column('dpaste_snippet', 'expires', self.gf('django.db.models.fields.DateTimeField')(default=None)) - - # Changing field 'Snippet.secret_id' - db.alter_column('dpaste_snippet', 'secret_id', self.gf('django.db.models.fields.CharField')(default='', max_length=255)) - - # Changing field 'Snippet.published' - db.alter_column('dpaste_snippet', 'published', self.gf('django.db.models.fields.DateTimeField')()) - - models = { - u'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'content': ('django.db.models.fields.TextField', [], {}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}), - u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': u"orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/0005_auto__add_field_snippet_expire_type__add_field_snippet_view_count.py b/dpaste/south_migrations/0005_auto__add_field_snippet_expire_type__add_field_snippet_view_count.py deleted file mode 100644 index c943cb4..0000000 --- a/dpaste/south_migrations/0005_auto__add_field_snippet_expire_type__add_field_snippet_view_count.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Snippet.expire_type' - db.add_column('dpaste_snippet', 'expire_type', - self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=1), - keep_default=False) - - # Adding field 'Snippet.view_count' - db.add_column('dpaste_snippet', 'view_count', - self.gf('django.db.models.fields.PositiveIntegerField')(default=0), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Snippet.expire_type' - db.delete_column('dpaste_snippet', 'expire_type') - - # Deleting field 'Snippet.view_count' - db.delete_column('dpaste_snippet', 'view_count') - - - models = { - u'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'content': ('django.db.models.fields.TextField', [], {}), - 'expire_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}), - u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': u"orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/0006_auto__add_unique_snippet_secret_id.py b/dpaste/south_migrations/0006_auto__add_unique_snippet_secret_id.py deleted file mode 100644 index d00596c..0000000 --- a/dpaste/south_migrations/0006_auto__add_unique_snippet_secret_id.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime - -from django.db import models -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding unique constraint on 'Snippet', fields ['secret_id'] - db.create_unique('dpaste_snippet', ['secret_id']) - - - def backwards(self, orm): - # Removing unique constraint on 'Snippet', fields ['secret_id'] - db.delete_unique('dpaste_snippet', ['secret_id']) - - - models = { - u'dpaste.snippet': { - 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, - 'content': ('django.db.models.fields.TextField', [], {}), - 'expire_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}), - 'expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lexer': ('django.db.models.fields.CharField', [], {'default': "'python'", 'max_length': '30'}), - u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': u"orm['dpaste.Snippet']"}), - 'published': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}) - } - } - - complete_apps = ['dpaste'] diff --git a/dpaste/south_migrations/__init__.py b/dpaste/south_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dpaste/tests/test_api.py b/dpaste/tests/test_api.py index 38c4107..a086bd4 100644 --- a/dpaste/tests/test_api.py +++ b/dpaste/tests/test_api.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- from __future__ import unicode_literals -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase from django.test.client import Client diff --git a/dpaste/tests/test_highlight.py b/dpaste/tests/test_highlight.py new file mode 100644 index 0000000..22dd7c1 --- /dev/null +++ b/dpaste/tests/test_highlight.py @@ -0,0 +1,14 @@ +# -*- encoding: utf-8 -*- +from __future__ import unicode_literals + +from dpaste import highlight +from django.test import TestCase + + +class HighlightAPITestCase(TestCase): + def test_simple_highlight(self): + input = 'int_value = 1' + expected = 'int_value = 1' + + value = highlight.pygmentize(input, lexer_name='python') + self.assertEqual(input, expected) \ No newline at end of file diff --git a/dpaste/tests/test_snippet.py b/dpaste/tests/test_snippet.py index 60c39e2..1b2b055 100644 --- a/dpaste/tests/test_snippet.py +++ b/dpaste/tests/test_snippet.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from datetime import timedelta from django.core import management -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase from django.test.client import Client from django.test.utils import override_settings diff --git a/dpaste/views.py b/dpaste/views.py index b0873be..e6009b0 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -6,7 +6,7 @@ import json from django.conf import settings from django.core.exceptions import ObjectDoesNotExist -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db.models import Count from django.http import (Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect) diff --git a/runtests.py b/runtests.py index 1c33db3..ab4273d 100755 --- a/runtests.py +++ b/runtests.py @@ -3,68 +3,18 @@ from __future__ import unicode_literals import sys +from django import setup from django.conf import settings +from django.test.runner import DiscoverRunner as TestRunner + +from dpaste.settings import tests as test_settings -SETTINGS = { - 'DATABASES': { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': 'dev.db', - }, - # 'default': { - # 'ENGINE': 'django.db.backends.mysql', - # 'NAME': 'dpaste', - # 'USER': 'root', - # 'PASSWORD': '', - # } - }, - 'TEMPLATES': [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.template.context_processors.i18n', - ], - }, - }, - ], - 'INSTALLED_APPS': [ - 'django.contrib.sessions', - 'django.contrib.staticfiles', - 'dpaste', - ], - 'MIDDLEWARE_CLASSES': ( - 'django.contrib.sessions.middleware.SessionMiddleware', - ), - 'STATIC_ROOT': '/tmp/dpaste_test_static/', - 'STATIC_URL': '/static/', - 'ROOT_URLCONF': 'dpaste.urls', - 'LANGUAGE_CODE': 'en', - 'LANGUAGES': (('en', 'English'),), -} def runtests(*test_args): # Setup settings if not settings.configured: - settings.configure(**SETTINGS) - - # New Django 1.7 app registry setup - try: - from django import setup - setup() - except ImportError: - pass - - # New Django 1.8 test runner - try: - from django.test.runner import DiscoverRunner as TestRunner - except ImportError: - from django.test.simple import DjangoTestSuiteRunner as TestRunner - + settings.configure(**test_settings.__dict__) + setup() test_runner = TestRunner(verbosity=1) failures = test_runner.run_tests(['dpaste']) if failures: diff --git a/setup.py b/setup.py index 5103716..f8cd113 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ long_description = u'\n\n'.join(( setup( name='dpaste', - version='3.0a', + version='3.0a0', 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.', @@ -49,15 +49,18 @@ setup( }, include_package_data=True, install_requires=[ - 'django>=1.8,<2.0', + 'django>=1.11', 'pygments>=1.6', - 'django-markup>=1.0', - 'django-csp>=3.3', - ], - tests_require=[ - 'tox>=1.6.1', + 'tox', 'coverage', ], + extras_require={ + # Packages required for a standalone setup + # (not integrated into an existing setup and settings) + 'standalone': { + 'django-csp>=3.3', + } + }, cmdclass={ 'test': Tox }, diff --git a/tox.ini b/tox.ini index ccea5c0..2673934 100644 --- a/tox.ini +++ b/tox.ini @@ -2,21 +2,34 @@ toxworkdir=/tmp/tox/dpaste skip_missing_interpreters=True envlist= - py{27,34,35,36}-django-{18,19,110,111} + coverage_setup + py{27,34,35,36}-django-{111} py{34,35,36}-django-{20} + coverage_report [testenv] -install_command = +install_command= pip install {opts} {packages} +extras= + standalone + tests + commands= - python runtests.py + coverage run --append runtests.py deps= # Django versions - django-18: django>=1.8,<1.9 - django-19: django>=1.9,<1.10 - django-110: django>=1.10,<1.11 django-111: django>=1.11,<1.12 - django-20: django==2.0a1 + django-20: django==2.0 +[testenv:coverage_setup] +basepython=python3.6 +commands= + coverage erase + +[testenv:coverage_report] +basepython=python3.6 +commands= + coverage report + coverage html