ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
549 stars 52 forks source link

pb: delete-before-get paste expiry #218

Closed buhman closed 6 years ago

buhman commented 6 years ago

This adds support for delete-before-get paste expiry behavior.

The previous behavior was, a paste would not be deleted until retrieved via GET, as a consequence of the delete logic being implemented there.

The expiry implementation has been moved to the model, making expiry calculations mandatory for all get types.

As a consequence of convenience, this necessarily refactors all count() method calls into more-direct next/stopiteration blocks (most usages were only concerned about >0 items, not the actual count), also adding a global error handler for views that choose to bubble up this exception.

codecov-io commented 6 years ago

Codecov Report

Merging #218 into master will increase coverage by 0.08%. The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #218      +/-   ##
==========================================
+ Coverage   75.39%   75.48%   +0.08%     
==========================================
  Files          18       18              
  Lines         878      885       +7     
==========================================
+ Hits          662      668       +6     
- Misses        216      217       +1
Impacted Files Coverage Δ
pb/cache.py 64.28% <100%> (-1.17%) :arrow_down:
pb/pb.py 95.45% <100%> (+0.1%) :arrow_up:
pb/paste/views.py 74.09% <87.5%> (+0.19%) :arrow_up:
pb/paste/model.py 96.77% <94.44%> (-1.27%) :arrow_down:
pb/util.py 88.37% <0%> (-1.17%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c80c0a8...64512da. Read the comment docs.