mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
merge
This commit is contained in:
parent
36216fe118
commit
c770457883
@ -29,4 +29,4 @@ GROUP = None
|
||||
|
||||
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
||||
# browser
|
||||
MAX_SIZE = 500 * 1000
|
||||
MAX_SIZE = 1024 * 50
|
||||
|
16
src/paste.py
16
src/paste.py
@ -153,15 +153,13 @@ class Paste(object):
|
||||
if self.expiration == "burn_after_reading":
|
||||
self.expiration = self.expiration + '#%s' % datetime.now()
|
||||
|
||||
# write the paste
|
||||
try:
|
||||
with open(self.path, 'w') as f:
|
||||
f.write(unicode(self.expiration) + '\n')
|
||||
f.write(self.content + '\n')
|
||||
if self.comments:
|
||||
f.write(comments)
|
||||
except Exception as e:
|
||||
import ipdb; ipdb.set_trace()
|
||||
# write the paste
|
||||
with open(self.path, 'w') as f:
|
||||
f.write(unicode(self.expiration) + '\n')
|
||||
f.write(self.content + '\n')
|
||||
if self.comments:
|
||||
f.write(comments)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
|
14
start.py
14
start.py
@ -54,11 +54,15 @@ def create_paste():
|
||||
return ''
|
||||
|
||||
if content:
|
||||
expiration = request.forms.get('expiration', u'burn_after_reading')
|
||||
paste = Paste(expiration=expiration, content=content)
|
||||
paste.save()
|
||||
return {'status': 'ok',
|
||||
'paste': paste.uuid}
|
||||
# check size of the paste. if more than settings return error without saving paste.
|
||||
# prevent from unusual use of the system.
|
||||
# need to be improved
|
||||
if len(content) < settings.MAX_SIZE:
|
||||
expiration = request.forms.get('expiration', u'burn_after_reading')
|
||||
paste = Paste(expiration=expiration, content=content)
|
||||
paste.save()
|
||||
return {'status': 'ok',
|
||||
'paste': paste.uuid}
|
||||
|
||||
return {'status': 'error',
|
||||
'message': u"Serveur error: the paste couldn't be saved. Please try later."}
|
||||
|
@ -259,6 +259,10 @@ button.btn, input[type="submit"].btn {
|
||||
top:-4px;
|
||||
}
|
||||
|
||||
#alert-template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/** Progress bar */
|
||||
|
||||
.progress {
|
||||
|
@ -74,4 +74,4 @@
|
||||
</span>
|
||||
|
||||
|
||||
%rebase base
|
||||
%rebase base
|
||||
|
Loading…
Reference in New Issue
Block a user