diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index df15c9d..0000000 --- a/.coveragerc +++ /dev/null @@ -1,17 +0,0 @@ -[run] -source = dpaste -branch = True -omit = - dpaste/migrations/* - dpaste/south_migrations/* - dpaste/tests/* - dpaste/settings/* - dpaste/wsgi.py - -[report] -exclude_lines = - pragma: no cover - def __repr__ - -[html] -directory = /tmp/coverage_html_report diff --git a/.env b/.env index f80d283..8c48127 100644 --- a/.env +++ b/.env @@ -1 +1,3 @@ +APPNAME = dpaste DJANGO_SETTINGS_MODULE=dpaste.settings.local + diff --git a/.gitignore b/.gitignore index be13b13..f39226a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.coverage build docs/_build dpaste/settings/local.py diff --git a/Pipfile b/Pipfile index 277e007..2213758 100644 --- a/Pipfile +++ b/Pipfile @@ -3,5 +3,22 @@ url = "https://pypi.python.org/simple" verify_ssl = true name = "pypi" +[packages] +dpaste = {editable = true,path = "."} + [dev-packages] -"e1839a8" = {path = ".", extras = ["local-development"], editable = true} +ipdb = "*" +isort = "*" +black = "*" +django-sslserver = "*" +sphinx = "*" +sphinx-autobuild = "*" +sphinx-rtd-theme = "*" +sphinxcontrib-httpdomain = "*" + +[scripts] +test = "./runtests.py" +cleanup = "sh -c \"black --skip-string-normalization --line-length=80 --exclude='/(migrations)/' $APPNAME && isort -rc $APPNAME\"" + +[pipenv] +allow_prereleases = true diff --git a/Pipfile.lock b/Pipfile.lock index 795bbd7..6818ef4 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "145e4ccaaada0f4e71e755c6c9e6ef2b0f53a3cd3f5fc3b34c359d2b97a17aba" + "sha256": "8b81eef506b63f0e0120e0d62fa871c3dca367b2d14852a6385a8a1a38dff729" }, "pipfile-spec": 6, "requires": {}, @@ -13,36 +13,7 @@ } ] }, - "default": {}, - "develop": { - "alabaster": { - "hashes": [ - "sha256:674bb3bab080f598371f4443c5008cbfeb1a5e622dd312395d2d82af2c54c456", - "sha256:b63b1f4dc77c074d386752ec4a8a7517600f6c0db8cd42980cae17ab7b3275d7" - ], - "version": "==0.7.11" - }, - "argh": { - "hashes": [ - "sha256:a9b3aaa1904eeb78e32394cd46c6f37ac0fb4af6dc488daa58971bdc7d7fcaf3", - "sha256:e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65" - ], - "version": "==0.26.2" - }, - "babel": { - "hashes": [ - "sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669", - "sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23" - ], - "version": "==2.6.0" - }, - "certifi": { - "hashes": [ - "sha256:376690d6f16d32f9d1fe8932551d80b23e9d393a8578c5633a2ed39a64861638", - "sha256:456048c7e371c089d0a77a5212fb37a2c2dce1e24146e3b7e0261736aaeaa22a" - ], - "version": "==2018.8.24" - }, + "default": { "cffi": { "hashes": [ "sha256:151b7eefd035c56b2b2e1eb9963c90c6302dc15fbd8c1c0a83a163ff2c7d7743", @@ -80,69 +51,53 @@ ], "version": "==1.11.5" }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "version": "==3.0.4" - }, "coverage": { "hashes": [ - "sha256:03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba", - "sha256:0b136648de27201056c1869a6c0d4e23f464750fd9a9ba9750b8336a244429ed", - "sha256:10a46017fef60e16694a30627319f38a2b9b52e90182dddb6e37dcdab0f4bf95", - "sha256:198626739a79b09fa0a2f06e083ffd12eb55449b5f8bfdbeed1df4910b2ca640", - "sha256:23d341cdd4a0371820eb2b0bd6b88f5003a7438bbedb33688cd33b8eae59affd", - "sha256:28b2191e7283f4f3568962e373b47ef7f0392993bb6660d079c62bd50fe9d162", - "sha256:2a5b73210bad5279ddb558d9a2bfedc7f4bf6ad7f3c988641d83c40293deaec1", - "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:be6cfcd8053d13f5f5eeb284aa8a814220c3da1b0078fa859011c7fffd86dab9", - "sha256:c1bb572fab8208c400adaf06a8133ac0712179a334c09224fb11393e920abcdd", - "sha256:de4418dadaa1c01d497e539210cb6baa015965526ff5afc078c57ca69160108d", - "sha256:e05cb4d9aad6233d67e0541caa7e511fa4047ed7750ec2510d466e806e0255d6", - "sha256:f3f501f345f24383c0000395b26b726e46758b71393267aeae0bd36f8b3ade80" + "sha256:029c69deaeeeae1b15bc6c59f0ffa28aa8473721c614a23f2c2976dec245cd12", + "sha256:02abbbebc6e9d5abe13cd28b5e963dedb6ffb51c146c916d17b18f141acd9947", + "sha256:1bbfe5b82a3921d285e999c6d256c1e16b31c554c29da62d326f86c173d30337", + "sha256:210c02f923df33a8d0e461c86fdcbbb17228ff4f6d92609fc06370a98d283c2d", + "sha256:2d0807ba935f540d20b49d5bf1c0237b90ce81e133402feda906e540003f2f7a", + "sha256:35d7a013874a7c927ce997350d314144ffc5465faf787bb4e46e6c4f381ef562", + "sha256:3636f9d0dcb01aed4180ef2e57a4e34bb4cac3ecd203c2a23db8526d86ab2fb4", + "sha256:42f4be770af2455a75e4640f033a82c62f3fb0d7a074123266e143269d7010ef", + "sha256:48440b25ba6cda72d4c638f3a9efa827b5b87b489c96ab5f4ff597d976413156", + "sha256:4dac8dfd1acf6a3ac657475dfdc66c621f291b1b7422a939cc33c13ac5356473", + "sha256:4e8474771c69c2991d5eab65764289a7dd450bbea050bc0ebb42b678d8222b42", + "sha256:551f10ddfeff56a1325e5a34eff304c5892aa981fd810babb98bfee77ee2fb17", + "sha256:5b104982f1809c1577912519eb249f17d9d7e66304ad026666cb60a5ef73309c", + "sha256:5c62aef73dfc87bfcca32cee149a1a7a602bc74bac72223236b0023543511c88", + "sha256:633151f8d1ad9467b9f7e90854a7f46ed8f2919e8bc7d98d737833e8938fc081", + "sha256:772207b9e2d5bf3f9d283b88915723e4e92d9a62c83f44ec92b9bd0cd685541b", + "sha256:7d5e02f647cd727afc2659ec14d4d1cc0508c47e6cfb07aea33d7aa9ca94d288", + "sha256:a9798a4111abb0f94584000ba2a2c74841f2cfe5f9254709756367aabbae0541", + "sha256:b38ea741ab9e35bfa7015c93c93bbd6a1623428f97a67083fc8ebd366238b91f", + "sha256:b6a5478c904236543c0347db8a05fac6fc0bd574c870e7970faa88e1d9890044", + "sha256:c6248bfc1de36a3844685a2e10ba17c18119ba6252547f921062a323fb31bff1", + "sha256:c705ab445936457359b1424ef25ccc0098b0491b26064677c39f1d14a539f056", + "sha256:d95a363d663ceee647291131dbd213af258df24f41350246842481ec3709bd33", + "sha256:e27265eb80cdc5dab55a40ef6f890e04ecc618649ad3da5265f128b141f93f78", + "sha256:ebc276c9cb5d917bd2ae959f84ffc279acafa9c9b50b0fa436ebb70bbe2166ea", + "sha256:f4d229866d030863d0fe3bf297d6d11e6133ca15bbb41ed2534a8b9a3d6bd061", + "sha256:f95675bd88b51474d4fe5165f3266f419ce754ffadfb97f10323931fa9ac95e5", + "sha256:f95bc54fb6d61b9f9ff09c4ae8ff6a3f5edc937cda3ca36fc937302a7c152bf1", + "sha256:fd0f6be53de40683584e5331c341e65a679dbe5ec489a0697cec7c2ef1a48cda" ], - "markers": "python_version != '3.1.*' and python_version < '4' and python_version != '3.2.*' and python_version != '3.0.*' and python_version >= '2.6'", - "version": "==4.5.1" + "version": "==5.0a4" }, "django": { "hashes": [ - "sha256:04f2e423f2e60943c02bd2959174b844f7d1bcd19eabb7f8e4282999958021fd", - "sha256:e1cc1cd6b658aa4e052f5f2b148bfda08091d7c3558529708342e37e4e33f72c" + "sha256:146aa583364553c9ecbed55613a6c27bc23226048f86ed183350c80df3f2a844", + "sha256:737bd3d5f70cb8bde3c660e69b077a0221b47caf499d4d3759fb086376002d4a" ], - "version": "==2.1.1" + "version": "==2.2a1" }, "django-csp": { "hashes": [ - "sha256:04c0ccd4e1339e8f6af48c55c3347dc996fde2d22d79e8bf2f6b7a920412e408", - "sha256:096b634430d8ea81c3d9f216f87be890f3a975c17bb9a4631f6a1619ac09c91e" + "sha256:04600237701e6d6ff78ed7d41209ff923988148bf292c128f6b474b9befe444f", + "sha256:8b9997df89a7a936d7c397e051367f974aa1d1a97d0b32acb4300087b3bed071" ], - "version": "==3.4" - }, - "django-sslserver": { - "hashes": [ - "sha256:6b2514427b4eed0713e478ae6dfdda622070a98f657d61a4502bf42b6311c66e" - ], - "version": "==0.20" + "version": "==3.5" }, "django-staticinline": { "hashes": [ @@ -159,28 +114,259 @@ ], "version": "==0.14" }, - "e1839a8": { + "dpaste": { "editable": true, - "extras": [ - "local-development" - ], "path": "." }, + "filelock": { + "hashes": [ + "sha256:b8d5ca5ca1c815e1574aee746650ea7301de63d87935b3463d26368b76e31633", + "sha256:d610c1bb404daf85976d7a82eb2ada120f04671007266b708606565dd03b5be6" + ], + "version": "==3.0.10" + }, + "misaka": { + "hashes": [ + "sha256:62f35254550095d899fc2ab8b33e156fc5e674176f074959cbca43cf7912ecd7" + ], + "version": "==2.1.1" + }, + "pluggy": { + "hashes": [ + "sha256:8ddc32f03971bfdf900a81961a48ccf2fb677cf7715108f85295c67405798616", + "sha256:980710797ff6a041e9a73a5787804f848996ecaa6f8a1b1e08224a5894f2074a" + ], + "version": "==0.8.1" + }, + "py": { + "hashes": [ + "sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694", + "sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6" + ], + "version": "==1.7.0" + }, + "pycparser": { + "hashes": [ + "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" + ], + "version": "==2.19" + }, + "pygments": { + "hashes": [ + "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", + "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d" + ], + "version": "==2.3.1" + }, + "pygments-lexer-solidity": { + "hashes": [ + "sha256:96080e5318a7e3d634d14411678d30a5e9400f24fe731a36045f1e214570565b" + ], + "version": "==0.3.1" + }, + "pytz": { + "hashes": [ + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" + ], + "version": "==2018.9" + }, + "six": { + "hashes": [ + "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", + "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" + ], + "version": "==1.12.0" + }, + "sqlparse": { + "hashes": [ + "sha256:ce028444cfab83be538752a2ffdb56bc417b7784ff35bb9a3062413717807dec", + "sha256:d9cf190f51cbb26da0412247dfe4fb5f4098edb73db84e02f9fc21fdca31fed4" + ], + "version": "==0.2.4" + }, + "toml": { + "hashes": [ + "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", + "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e" + ], + "version": "==0.10.0" + }, + "tox": { + "hashes": [ + "sha256:04f8f1aa05de8e76d7a266ccd14e0d665d429977cd42123bc38efa9b59964e9e", + "sha256:25ef928babe88c71e3ed3af0c464d1160b01fca2dd1870a5bb26c2dea61a17fc" + ], + "version": "==3.7.0" + }, + "virtualenv": { + "hashes": [ + "sha256:34b9ae3742abed2f95d3970acf4d80533261d6061b51160b197f84e5b4c98b4c", + "sha256:fa736831a7b18bd2bfeef746beb622a92509e9733d645952da136b0639cd40cd" + ], + "version": "==16.2.0" + } + }, + "develop": { + "alabaster": { + "hashes": [ + "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359", + "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02" + ], + "version": "==0.7.12" + }, + "appdirs": { + "hashes": [ + "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", + "sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e" + ], + "version": "==1.4.3" + }, + "appnope": { + "hashes": [ + "sha256:5b26757dc6f79a3b7dc9fab95359328d5747fcb2409d331ea66d0272b90ab2a0", + "sha256:8b995ffe925347a2138d7ac0fe77155e4311a0ea6d6da4f5128fe4b3cbe5ed71" + ], + "markers": "sys_platform == 'darwin'", + "version": "==0.1.0" + }, + "argh": { + "hashes": [ + "sha256:a9b3aaa1904eeb78e32394cd46c6f37ac0fb4af6dc488daa58971bdc7d7fcaf3", + "sha256:e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65" + ], + "version": "==0.26.2" + }, + "attrs": { + "hashes": [ + "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69", + "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb" + ], + "version": "==18.2.0" + }, + "babel": { + "hashes": [ + "sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669", + "sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23" + ], + "version": "==2.6.0" + }, + "backcall": { + "hashes": [ + "sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4", + "sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2" + ], + "version": "==0.1.0" + }, + "black": { + "hashes": [ + "sha256:817243426042db1d36617910df579a54f1afd659adb96fc5032fcf4b36209739", + "sha256:e030a9a28f542debc08acceb273f228ac422798e5215ba2a791a6ddeaaca22a5" + ], + "index": "pypi", + "version": "==18.9b0" + }, + "certifi": { + "hashes": [ + "sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7", + "sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033" + ], + "version": "==2018.11.29" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "click": { + "hashes": [ + "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", + "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" + ], + "version": "==7.0" + }, + "decorator": { + "hashes": [ + "sha256:33cd704aea07b4c28b3eb2c97d288a06918275dac0ecebdaf1bc8a48d98adb9e", + "sha256:cabb249f4710888a2fc0e13e9a16c343d932033718ff62e1e9bc93a9d3a9122b" + ], + "version": "==4.3.2" + }, + "django": { + "hashes": [ + "sha256:146aa583364553c9ecbed55613a6c27bc23226048f86ed183350c80df3f2a844", + "sha256:737bd3d5f70cb8bde3c660e69b077a0221b47caf499d4d3759fb086376002d4a" + ], + "version": "==2.2a1" + }, + "django-sslserver": { + "hashes": [ + "sha256:6b2514427b4eed0713e478ae6dfdda622070a98f657d61a4502bf42b6311c66e" + ], + "index": "pypi", + "version": "==0.20" + }, + "docutils": { + "hashes": [ + "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" + ], + "version": "==0.14" + }, "idna": { "hashes": [ - "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", - "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" + "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", + "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" ], - "version": "==2.7" + "version": "==2.8" }, "imagesize": { "hashes": [ "sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8", "sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", "version": "==1.1.0" }, + "ipdb": { + "hashes": [ + "sha256:7081c65ed7bfe7737f83fa4213ca8afd9617b42ff6b3f1daf9a3419839a2a00a" + ], + "index": "pypi", + "version": "==0.11" + }, + "ipython": { + "hashes": [ + "sha256:6a9496209b76463f1dec126ab928919aaf1f55b38beb9219af3fe202f6bbdd12", + "sha256:f69932b1e806b38a7818d9a1e918e5821b685715040b48e59c657b3c7961b742" + ], + "version": "==7.2.0" + }, + "ipython-genutils": { + "hashes": [ + "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", + "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" + ], + "version": "==0.2.0" + }, + "isort": { + "hashes": [ + "sha256:1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af", + "sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8", + "sha256:ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497" + ], + "index": "pypi", + "version": "==4.3.4" + }, + "jedi": { + "hashes": [ + "sha256:571702b5bd167911fe9036e5039ba67f820d6502832285cde8c881ab2b2149fd", + "sha256:c8481b5e59d34a5c7c42e98f6625e633f6ef59353abea6437472c7ec2093f191" + ], + "version": "==0.13.2" + }, "jinja2": { "hashes": [ "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", @@ -190,30 +376,57 @@ }, "livereload": { "hashes": [ - "sha256:583179dc8d49b040a9da79bd33de59e160d2a8802b939e304eb359a4419f6498", - "sha256:dd4469a8f5a6833576e9f5433f1439c306de15dbbfeceabd32479b1123380fa5" + "sha256:29cadfabcedd12eed792e0131991235b9d4764d4474bed75cf525f57109ec0a2", + "sha256:e632a6cd1d349155c1d7f13a65be873b38f43ef02961804a1bba8d817fa649a7" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", - "version": "==2.5.2" + "version": "==2.6.0" }, "markupsafe": { "hashes": [ - "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + "sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432", + "sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b", + "sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9", + "sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af", + "sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834", + "sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd", + "sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d", + "sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7", + "sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b", + "sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3", + "sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c", + "sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2", + "sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7", + "sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36", + "sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1", + "sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e", + "sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1", + "sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c", + "sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856", + "sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550", + "sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492", + "sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672", + "sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401", + "sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6", + "sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6", + "sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c", + "sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd", + "sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1" ], - "version": "==1.0" - }, - "misaka": { - "hashes": [ - "sha256:87637d90f5f52595d07ed1be93d0576d32632d125694b96b8e4ce55cd4c019fb" - ], - "version": "==2.1.0" + "version": "==1.1.0" }, "packaging": { "hashes": [ - "sha256:e9215d2d2535d3ae866c3d6efc77d5b24a0192cce0ff20e42896cc0664f889c0", - "sha256:f019b770dd64e585a99714f1fd5e01c7a8f11b45635aa953fd41c689a657375b" + "sha256:0c98a5d0be38ed775798ece1b9727178c4469d9c3b4ada66e8e6b7849f8732af", + "sha256:9e1cbf8c12b1f1ce0bb5344b8d7ecf66a6f8a6e91bcb0c84593ed6d3ab5c4ab3" ], - "version": "==17.1" + "version": "==19.0" + }, + "parso": { + "hashes": [ + "sha256:4b8f9ed80c3a4a3191aa3261505d868aa552dd25649cb13a7d73b6b7315edf2d", + "sha256:5a120be2e8863993b597f1c0437efca799e90e0793c98ae5d4e34ebd00140e31" + ], + "version": "==0.3.2" }, "pathtools": { "hashes": [ @@ -221,13 +434,20 @@ ], "version": "==0.1.2" }, - "pluggy": { + "pexpect": { "hashes": [ - "sha256:6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1", - "sha256:95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1" + "sha256:2a8e88259839571d1251d278476f3eec5db26deb73a70be5ed5dc5435e418aba", + "sha256:3fbd41d4caf27fa4a377bfd16fef87271099463e6fa73e92a52f92dfee5d425b" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", - "version": "==0.7.1" + "markers": "sys_platform != 'win32'", + "version": "==4.6.0" + }, + "pickleshare": { + "hashes": [ + "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", + "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56" + ], + "version": "==0.7.5" }, "port-for": { "hashes": [ @@ -235,76 +455,65 @@ ], "version": "==0.3.1" }, - "py": { + "prompt-toolkit": { "hashes": [ - "sha256:06a30435d058473046be836d3fc4f27167fd84c45b99704f2fb5509ef61f9af1", - "sha256:50402e9d1c9005d759426988a492e0edaadb7f4e68bcddfea586bc7432d009c6" + "sha256:c1d6aff5252ab2ef391c2fe498ed8c088066f66bc64a8d5c095bbf795d9fec34", + "sha256:d4c47f79b635a0e70b84fdb97ebd9a274203706b1ee5ed44c10da62755cf3ec9", + "sha256:fd17048d8335c1e6d5ee403c3569953ba3eb8555d710bfc548faf0712666ea39" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", - "version": "==1.6.0" + "version": "==2.0.7" }, - "pycparser": { + "ptyprocess": { "hashes": [ - "sha256:99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226" + "sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0", + "sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f" ], - "version": "==2.18" + "version": "==0.6.0" }, "pygments": { "hashes": [ - "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", - "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", + "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d" ], - "version": "==2.2.0" - }, - "pygments-lexer-solidity": { - "hashes": [ - "sha256:96080e5318a7e3d634d14411678d30a5e9400f24fe731a36045f1e214570565b" - ], - "version": "==0.3.1" + "version": "==2.3.1" }, "pyparsing": { "hashes": [ - "sha256:0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04", - "sha256:fee43f17a9c4087e7ed1605bd6df994c6173c1e977d7ade7b651292fab2bd010" + "sha256:66c9268862641abcac4a96ba74506e594c884e3f57690a696d21ad8210ed667a", + "sha256:f6c5ef0d7480ad048c054c37632c67fca55299990fff127850181659eea33fc3" ], - "version": "==2.2.0" + "version": "==2.3.1" }, "pytz": { "hashes": [ - "sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053", - "sha256:ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277" + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" ], - "version": "==2018.5" + "version": "==2018.9" }, "pyyaml": { "hashes": [ - "sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b", - "sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf", - "sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a", - "sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3", - "sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1", - "sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1", - "sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613", - "sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04", - "sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f", - "sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537", - "sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531" + "sha256:254bf6fda2b7c651837acb2c718e213df29d531eebf00edb54743d10bcb694eb", + "sha256:3108529b78577327d15eec243f0ff348a0640b0c3478d67ad7f5648f93bac3e2", + "sha256:3c17fb92c8ba2f525e4b5f7941d850e7a48c3a59b32d331e2502a3cdc6648e76", + "sha256:8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b", + "sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b" ], - "version": "==3.13" + "version": "==4.2b4" }, "requests": { "hashes": [ - "sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1", - "sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a" + "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", + "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b" ], - "version": "==2.19.1" + "version": "==2.21.0" }, "six": { "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", + "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" ], - "version": "==1.11.0" + "version": "==1.12.0" }, "snowballstemmer": { "hashes": [ @@ -315,30 +524,34 @@ }, "sphinx": { "hashes": [ - "sha256:95acd6648902333647a0e0564abdb28a74b0a76d2333148aa35e5ed1f56d3c4b", - "sha256:c091dbdd5cc5aac6eb95d591a819fd18bccec90ffb048ec465b165a48b839b45" + "sha256:429e3172466df289f0f742471d7e30ba3ee11f3b5aecd9a840480d03f14bcfe5", + "sha256:c4cb17ba44acffae3d3209646b6baec1e215cad3065e852c68cc569d4df1b9f8" ], - "version": "==1.8.0" + "index": "pypi", + "version": "==1.8.3" }, "sphinx-autobuild": { "hashes": [ "sha256:66388f81884666e3821edbe05dd53a0cfb68093873d17320d0610de8db28c74e", "sha256:e60aea0789cab02fa32ee63c7acae5ef41c06f1434d9fd0a74250a61f5994692" ], + "index": "pypi", "version": "==0.7.1" }, "sphinx-rtd-theme": { "hashes": [ - "sha256:3b49758a64f8a1ebd8a33cb6cc9093c3935a908b716edfaa5772fd86aac27ef6", - "sha256:80e01ec0eb711abacb1fa507f3eae8b805ae8fa3e8b057abfdf497e3f644c82c" + "sha256:02f02a676d6baabb758a20c7a479d58648e0f64f13e07d1b388e9bb2afe86a09", + "sha256:d0f6bc70f98961145c5b0e26a992829363a197321ba571b31b24ea91879e0c96" ], - "version": "==0.4.1" + "index": "pypi", + "version": "==0.4.2" }, "sphinxcontrib-httpdomain": { "hashes": [ "sha256:1fb5375007d70bf180cdd1c79e741082be7aa2d37ba99efe561e1c2e3f38191e", "sha256:ac40b4fba58c76b073b03931c7b8ead611066a6aebccafb34dc19694f4eb6335" ], + "index": "pypi", "version": "==1.7.0" }, "sphinxcontrib-websupport": { @@ -346,57 +559,54 @@ "sha256:68ca7ff70785cbe1e7bccc71a48b5b6d965d79ca50629606c7861a21b206d9dd", "sha256:9de47f375baf1ea07cdb3436ff39d7a9c76042c10a769c52353ec46e4e8fc3b9" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", "version": "==1.1.0" }, + "sqlparse": { + "hashes": [ + "sha256:ce028444cfab83be538752a2ffdb56bc417b7784ff35bb9a3062413717807dec", + "sha256:d9cf190f51cbb26da0412247dfe4fb5f4098edb73db84e02f9fc21fdca31fed4" + ], + "version": "==0.2.4" + }, "toml": { "hashes": [ - "sha256:380178cde50a6a79f9d2cf6f42a62a5174febe5eea4126fe4038785f1d888d42", - "sha256:a7901919d3e4f92ffba7ff40a9d697e35bbbc8a8049fe8da742f34c83606d957" + "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", + "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e" ], - "version": "==0.9.6" + "version": "==0.10.0" }, "tornado": { "hashes": [ - "sha256:0662d28b1ca9f67108c7e3b77afabfb9c7e87bde174fbda78186ecedc2499a9d", - "sha256:4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409", - "sha256:732e836008c708de2e89a31cb2fa6c0e5a70cb60492bee6f1ea1047500feaf7f", - "sha256:8154ec22c450df4e06b35f131adc4f2f3a12ec85981a203301d310abf580500f", - "sha256:8e9d728c4579682e837c92fdd98036bd5cdefa1da2aaf6acf26947e6dd0c01c5", - "sha256:d4b3e5329f572f055b587efc57d29bd051589fb5a43ec8898c77a47ec2fa2bbb", - "sha256:e5f2585afccbff22390cddac29849df463b252b711aa2ce7c5f3f342a5b3b444" + "sha256:00ebd485a52bd7eaa3f35bdf8ab43c109aaa2edc722849b6905c1ffd8c958e82" ], - "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'", - "version": "==5.1.1" + "version": "==6.0a1" }, - "tox": { + "traitlets": { "hashes": [ - "sha256:433bb93c57edae263150767e672a0d468ab4fefcc1958eb4013e56a670bb851e", - "sha256:bfb4e4efb7c61a54bc010a5c00fdbe0973bc4bdf04090bfcd3c93c901006177c" + "sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835", + "sha256:c6cb5e6f57c5a9bdaa40fa71ce7b4af30298fbab9ece9815b5d995ab6217c7d9" ], - "version": "==3.3.0" + "version": "==4.3.2" }, "urllib3": { "hashes": [ - "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf", - "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5" + "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", + "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" ], - "markers": "python_version != '3.1.*' and python_version != '3.3.*' and python_version < '4' and python_version != '3.2.*' and python_version != '3.0.*' and python_version >= '2.6'", - "version": "==1.23" - }, - "virtualenv": { - "hashes": [ - "sha256:2ce32cd126117ce2c539f0134eb89de91a8413a29baac49cbab3eb50e2026669", - "sha256:ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752" - ], - "markers": "python_version != '3.1.*' and python_version != '3.0.*' and python_version >= '2.7' and python_version != '3.2.*'", - "version": "==16.0.0" + "version": "==1.24.1" }, "watchdog": { "hashes": [ "sha256:965f658d0732de3188211932aeb0bb457587f04f63ab4c1e33eab878e9de961d" ], "version": "==0.9.0" + }, + "wcwidth": { + "hashes": [ + "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", + "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c" + ], + "version": "==0.1.7" } } } diff --git a/README.rst b/README.rst index 6eeb32b..dc755cb 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,3 @@ -.. _index: - ====== dpaste ====== diff --git a/dpaste/__init__.py b/dpaste/__init__.py index 965b81d..a629a55 100644 --- a/dpaste/__init__.py +++ b/dpaste/__init__.py @@ -1,7 +1,9 @@ VERSION = (3, 0, 'a', 1) __version__ = '{major}.{minor}{rest}'.format( - major=VERSION[0], minor=VERSION[1], rest=''.join(str(i) for i in VERSION[2:]) + major=VERSION[0], + minor=VERSION[1], + rest=''.join(str(i) for i in VERSION[2:]), ) default_app_config = 'dpaste.apps.dpasteAppConfig' diff --git a/dpaste/apps.py b/dpaste/apps.py index 171085f..dc2662e 100644 --- a/dpaste/apps.py +++ b/dpaste/apps.py @@ -14,7 +14,9 @@ class dpasteAppConfig(AppConfig): # String. A string of characters which are used to create the random slug. # This is intentionally missing l and I as they look too similar with # sans-serif fonts. - SLUG_CHOICES = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890' + SLUG_CHOICES = ( + 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890' + ) # String. The lexer key that is pre-selected in the dropdown. Note that # this is only used if the user has not saved a snippet before, otherwise diff --git a/dpaste/forms.py b/dpaste/forms.py index 9fcb0d9..5ec8cba 100644 --- a/dpaste/forms.py +++ b/dpaste/forms.py @@ -37,9 +37,7 @@ class SnippetForm(forms.ModelForm): ) lexer = forms.ChoiceField( - label=_('Lexer'), - initial=LEXER_DEFAULT, - choices=LEXER_CHOICES + label=_('Lexer'), initial=LEXER_DEFAULT, choices=LEXER_CHOICES ) expires = forms.ChoiceField( @@ -48,10 +46,7 @@ class SnippetForm(forms.ModelForm): initial=config.EXPIRE_DEFAULT, ) - rtl = forms.BooleanField( - label=_('Right to Left'), - required=False - ) + rtl = forms.BooleanField(label=_('Right to Left'), required=False) # Honeypot field title = forms.CharField( diff --git a/dpaste/highlight.py b/dpaste/highlight.py index ec20a39..1d906aa 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -5,6 +5,7 @@ from django.template.defaultfilters import escape, linebreaksbr from django.template.loader import render_to_string from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ + from pygments import highlight from pygments.formatters.html import HtmlFormatter from pygments.lexers import get_lexer_by_name @@ -79,7 +80,7 @@ class MarkdownHighlighter(PlainTextHighlighter): misaka.html( code_string, extensions=self.extensions, - render_flags=self.render_flags + render_flags=self.render_flags, ) ) diff --git a/dpaste/management/commands/cleanup_snippets.py b/dpaste/management/commands/cleanup_snippets.py index 50328e0..d8517a6 100644 --- a/dpaste/management/commands/cleanup_snippets.py +++ b/dpaste/management/commands/cleanup_snippets.py @@ -9,7 +9,10 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--dry-run', action='store_true', dest='dry_run', help='Don\'t do anything.' + '--dry-run', + action='store_true', + dest='dry_run', + help='Don\'t do anything.', ), def handle(self, *args, **options): @@ -21,7 +24,9 @@ class Command(BaseCommand): 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()) + self.stdout.write( + u"Will delete %s snippet(s):\n" % deleteable_snippets.count() + ) for d in deleteable_snippets: self.stdout.write(u"- %s (%s)\n" % (d.secret_id, d.expires)) if options.get('dry_run'): diff --git a/dpaste/models.py b/dpaste/models.py index b5f15e8..c87c75e 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -5,6 +5,7 @@ from django.apps import apps from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _ + from six import python_2_unicode_compatible from dpaste import highlight @@ -86,9 +87,7 @@ class Snippet(models.Model): super(Snippet, self).save(*args, **kwargs) def get_absolute_url(self): - return reverse( - 'snippet_details', kwargs={'snippet_id': self.secret_id} - ) + return reverse('snippet_details', kwargs={'snippet_id': self.secret_id}) def highlight(self): HighlighterClass = highlight.get_highlighter_class(self.lexer) diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index 5371334..30d8392 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -1,11 +1,12 @@ # Import global settings to make it easier to extend settings. -from django.conf.global_settings import * - # ============================================================================== # Calculation of directories relative to the module location # ============================================================================== import os import sys + +from django.conf.global_settings import * + import dpaste PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split( @@ -59,7 +60,9 @@ LANGUAGES = (('en', 'English'),) # Project URLS and media settings # ============================================================================== -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' +STATICFILES_STORAGE = ( + 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' +) STATICFILES_DIRS = (os.path.join(PROJECT_DIR, 'build'),) @@ -142,7 +145,9 @@ CSP_STYLE_SRC = ("'self'", "'unsafe-inline'") LOGGING = { 'version': 1, 'disable_existing_loggers': False, - 'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}}, + 'filters': { + 'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'} + }, 'handlers': { 'mail_admins': { 'level': 'ERROR', diff --git a/dpaste/settings/tests.py b/dpaste/settings/tests.py index eb8b89b..0fddb01 100644 --- a/dpaste/settings/tests.py +++ b/dpaste/settings/tests.py @@ -4,4 +4,6 @@ Settings for the test suite from .base import * -DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} +DATABASES = { + 'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'} +} diff --git a/dpaste/tests/test_api.py b/dpaste/tests/test_api.py index a8f6579..e71e730 100644 --- a/dpaste/tests/test_api.py +++ b/dpaste/tests/test_api.py @@ -145,7 +145,8 @@ class SnippetAPITestCase(TestCase): def test_expire_choices_invalid_given(self): # A expire choice that does not exist returns a BadRequest response = self.client.post( - self.api_url, {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'foobar'} + self.api_url, + {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'foobar'}, ) self.assertEqual(response.status_code, 400) self.assertEqual(Snippet.objects.count(), 0) @@ -157,23 +158,30 @@ class SnippetAPITestCase(TestCase): def test_valid_expiration_choices_onetime(self): response = self.client.post( - self.api_url, {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'onetime'} + self.api_url, + {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'onetime'}, ) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) - self.assertEqual(Snippet.objects.all()[0].expire_type, Snippet.EXPIRE_ONETIME) + self.assertEqual( + Snippet.objects.all()[0].expire_type, Snippet.EXPIRE_ONETIME + ) def test_valid_expiration_choices_never(self): response = self.client.post( - self.api_url, {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'never'} + self.api_url, + {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 'never'}, ) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) - self.assertEqual(Snippet.objects.all()[0].expire_type, Snippet.EXPIRE_KEEP) + self.assertEqual( + Snippet.objects.all()[0].expire_type, Snippet.EXPIRE_KEEP + ) def test_valid_expiration_choices_hour(self): response = self.client.post( - self.api_url, {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 3600} + self.api_url, + {'content': u"Hello Wörld.\n\tGood Bye", 'expires': 3600}, ) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) @@ -203,7 +211,11 @@ class SnippetAPITestCase(TestCase): """ response = self.client.post( self.api_url, - {'content': u"Hello Wörld.\n\tGood Bye", 'lexer': '', 'filename': ''}, + { + 'content': u"Hello Wörld.\n\tGood Bye", + 'lexer': '', + 'filename': '', + }, ) self.assertEqual(response.status_code, 400) @@ -237,7 +249,9 @@ class SnippetAPITestCase(TestCase): ) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) - self.assertEqual(Snippet.objects.all()[0].lexer, config.PLAIN_CODE_SYMBOL) + self.assertEqual( + Snippet.objects.all()[0].lexer, config.PLAIN_CODE_SYMBOL + ) def test_filename_and_lexer_given(self): """ diff --git a/dpaste/tests/test_highlight.py b/dpaste/tests/test_highlight.py index f093536..aaecc15 100644 --- a/dpaste/tests/test_highlight.py +++ b/dpaste/tests/test_highlight.py @@ -4,11 +4,8 @@ from textwrap import dedent from django.test import TestCase -from dpaste.highlight import ( - PlainCodeHighlighter, - PygmentsHighlighter, - RestructuredTextHighlighter, -) +from dpaste.highlight import (PlainCodeHighlighter, PygmentsHighlighter, + RestructuredTextHighlighter) class HighlightAPITestCase(TestCase): diff --git a/dpaste/tests/test_snippet.py b/dpaste/tests/test_snippet.py index 2e82b94..e1e1c16 100644 --- a/dpaste/tests/test_snippet.py +++ b/dpaste/tests/test_snippet.py @@ -142,7 +142,9 @@ class SnippetTestCase(TestCase): def test_reply(self): data = self.valid_form_data() response = self.client.post(self.new_url, data, follow=True) - response = self.client.post(response.request['PATH_INFO'], data, follow=True) + response = self.client.post( + response.request['PATH_INFO'], data, follow=True + ) self.assertContains(response, data['content']) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 2) @@ -151,7 +153,9 @@ class SnippetTestCase(TestCase): data = self.valid_form_data() response = self.client.post(self.new_url, data, follow=True) del data['content'] - response = self.client.post(response.request['PATH_INFO'], data, follow=True) + response = self.client.post( + response.request['PATH_INFO'], data, follow=True + ) self.assertEqual(response.status_code, 200) self.assertEqual(Snippet.objects.count(), 1) @@ -302,7 +306,9 @@ class SnippetTestCase(TestCase): management.call_command('cleanup_snippets') self.assertEqual(Snippet.objects.count(), 1) - def test_delete_management_snippet_that_never_expires_will_not_get_deleted(self): + def test_delete_management_snippet_that_never_expires_will_not_get_deleted( + self + ): """ Snippets without an expiration date wont get deleted automatically. """ @@ -329,9 +335,9 @@ class SnippetTestCase(TestCase): """ for i in range(0, 100): Snippet.objects.create(content='foobar') - slug_list = Snippet.objects.values_list('secret_id', flat=True).order_by( - 'published' - ) + slug_list = Snippet.objects.values_list( + 'secret_id', flat=True + ).order_by('published') self.assertEqual(len(set(slug_list)), 100) def test_leading_white_is_retained_in_db(self): diff --git a/dpaste/urls/dpaste_api.py b/dpaste/urls/dpaste_api.py index 650428f..a11bbb0 100644 --- a/dpaste/urls/dpaste_api.py +++ b/dpaste/urls/dpaste_api.py @@ -4,5 +4,9 @@ from django.views.decorators.csrf import csrf_exempt from ..views import APIView urlpatterns = [ - url(r'^api/$', csrf_exempt(APIView.as_view()), name='dpaste_api_create_snippet') + url( + r'^api/$', + csrf_exempt(APIView.as_view()), + name='dpaste_api_create_snippet', + ) ] diff --git a/dpaste/views.py b/dpaste/views.py index faf6d38..d7c4eff 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -3,22 +3,17 @@ import difflib import json from django.apps import apps -from django.http import ( - Http404, - HttpResponse, - HttpResponseBadRequest, - HttpResponseRedirect, -) +from django.http import (Http404, HttpResponse, HttpResponseBadRequest, + HttpResponseRedirect) from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.translation import ugettext -from django.views.defaults import ( - page_not_found as django_page_not_found, - server_error as django_server_error, -) +from django.views.defaults import page_not_found as django_page_not_found +from django.views.defaults import server_error as django_server_error from django.views.generic import FormView from django.views.generic.base import TemplateView, View from django.views.generic.detail import DetailView + from pygments.lexers import get_lexer_for_filename from pygments.util import ClassNotFound @@ -39,6 +34,7 @@ class SnippetView(FormView): """ Create a new snippet. """ + form_class = SnippetForm template_name = 'dpaste/new.html' @@ -71,7 +67,9 @@ class SnippetDetailView(SnippetView, DetailView): always expire. """ if 'delete' in self.request.POST: - snippet = get_object_or_404(Snippet, secret_id=self.kwargs['snippet_id']) + snippet = get_object_or_404( + Snippet, secret_id=self.kwargs['snippet_id'] + ) snippet.delete() # Append `#` so #delete goes away in Firefox @@ -218,7 +216,9 @@ class APIView(View): base_url = config.get_base_url(request=self.request) return json.dumps( { - 'url': '{url}{path}'.format(url=base_url, path=s.get_absolute_url()), + 'url': '{url}{path}'.format( + url=base_url, path=s.get_absolute_url() + ), 'content': s.content, 'lexer': s.lexer, } @@ -269,11 +269,16 @@ class APIView(View): ) expires, expire_type = get_expire_values(expires) else: - expires = datetime.datetime.now() + datetime.timedelta(seconds=60 * 60 * 24) + expires = datetime.datetime.now() + datetime.timedelta( + seconds=60 * 60 * 24 + ) expire_type = Snippet.EXPIRE_TIME snippet = Snippet.objects.create( - content=content, lexer=lexer, expires=expires, expire_type=expire_type + content=content, + lexer=lexer, + expires=expires, + expire_type=expire_type, ) # Custom formatter for the API response @@ -292,8 +297,12 @@ class APIView(View): def page_not_found(request, exception=None, template_name='dpaste/404.html'): - return django_page_not_found(request, exception, 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=template_name) # pragma: no cover + return django_server_error( + request, template_name=template_name + ) # pragma: no cover diff --git a/dpaste/wsgi.py b/dpaste/wsgi.py index 6602e2e..359c731 100644 --- a/dpaste/wsgi.py +++ b/dpaste/wsgi.py @@ -9,8 +9,7 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ import os -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dpaste.settings.local") - from django.core.wsgi import get_wsgi_application +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dpaste.settings.local") application = get_wsgi_application() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..dd839c9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,72 @@ +[metadata] +name = django-attachments +version = dpaste.__version__ +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. +long_description = file: README.rst, CHANGELOG.rst +author = Martin Mahner +author_email = martin@mahner.org +url = https://github.com/bartTC/dpaste +keywords = django, attachments, files, upload +license = MIT +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Framework :: Django + +[options] +packages = find: +include_package_data = True +zip_safe = False +python_requires = '>=3.4' +install_requires = + # Essential packages + six + django>=1.11 + pygments>=1.6 + django-staticinline>=1.0 + django-csp>=3.3 + + # Additional Code Lexer + pygments-lexer-solidity>=0.1.0 + + # Additional Text Lexer + misaka>=2.1.0 + docutils + + # Testsuite + tox + coverage + +[isort] +default_section = THIRDPARTY +known_first_party = dpaste +known_django = django +sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER +skip = migrations + +[coverage:run] +source = dpaste +branch = True +omit = + attachments/migrations/* + attachments/tests/* + +[coverage:report] +exclude_lines = + pragma: no cover + def __repr__ + +[coverage:html] +directory = /tmp/coverage_report/dpaste diff --git a/setup.py b/setup.py index 45d47bb..bb42283 100644 --- a/setup.py +++ b/setup.py @@ -1,72 +1,3 @@ #!/usr/bin/env python - -from setuptools import find_packages, setup - -long_description = '\n\n'.join(( - open('README.rst').read(), - open('CHANGELOG.rst').read() -)) -import dpaste - -setup( - name='dpaste', - version=dpaste.__version__, - 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.', - long_description=long_description, - author='Martin Mahner', - author_email='martin@mahner.org', - url='https://github.com/bartTC/dpaste/', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Framework :: Django', - ], - python_requires='>=3.4', - packages=find_packages(), - package_data={ - 'dpaste': ['static/*.*', 'templates/*.*'], - 'docs': ['*'], - }, - include_package_data=True, - install_requires=[ - # Essential packages - 'six', - 'django>=1.11', - 'pygments>=1.6', - 'django-staticinline>=1.0', - - # Additional Code Lexer - 'pygments-lexer-solidity>=0.1.0', - - # Additional Text Lexer - 'misaka>=2.1.0', - 'docutils', - - # Testsuite - 'tox', - 'coverage', - ], - extras_require={ - # Packages required for a standalone setup - # (not integrated into an existing setup and settings) - 'standalone': [ - 'django-csp>=3.3', - ], - # Useful tools for local development - 'local-development': [ - 'django-csp>=3.3', - 'django-sslserver', - 'sphinx', - 'sphinx-autobuild', - 'sphinx-rtd-theme', - 'sphinxcontrib-httpdomain', - ] - } -) - +from setuptools import setup +setup() diff --git a/tox.ini b/tox.ini index e99697f..40e7cfa 100644 --- a/tox.ini +++ b/tox.ini @@ -9,15 +9,10 @@ envlist= coverage_report [testenv] -install_command= +install_command = pip install {opts} {packages} - -extras= - standalone - commands= coverage run --append runtests.py - deps= # Django versions django-111: django>=1.11,<2.0 @@ -26,12 +21,13 @@ deps= [testenv:coverage_setup] skip_install = True -basepython=python3.6 -commands= - coverage erase +deps = coverage +basepython = python3.6 +commands = coverage erase [testenv:coverage_report] skip_install = True +deps = coverage basepython=python3.6 commands= coverage report