aboutsummaryrefslogtreecommitdiff
path: root/cgi/weabot.py
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/weabot.py')
-rwxr-xr-xcgi/weabot.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/cgi/weabot.py b/cgi/weabot.py
index c38a972..a85c2e7 100755
--- a/cgi/weabot.py
+++ b/cgi/weabot.py
@@ -38,7 +38,9 @@ class weabot(object):
self.environ["PATH_INFO"] = self.environ["PATH_INFO"][11:]
self.start = start_response
- self.formdata = getFormData(self)
+
+ if self.environ["QUERY_STRING"] != "rawpost":
+ self.formdata = getFormData(self)
self.output = ""
@@ -597,15 +599,23 @@ class weabot(object):
# process files
if oek_file:
try:
- fname = "%s/oek_temp/%s.png" % (Settings.HOME_DIR, oek_file)
- with open(fname) as f:
+ fname = "%s/%s/temp/%s.png" % (Settings.IMAGES_DIR, board['dir'], oek_file)
+ with open(fname, 'rb') as f:
file = f.read()
- os.remove(fname)
except:
raise UserError, "Imposible leer la imagen oekaki."
if file and not noimage:
post = processImage(post, file, t, file_original, (spoil and board['allow_spoilers'] == '1'))
+
+ if oek_file:
+ # Remove temporary oekaki file if everything went right
+ #os.remove(fname)
+ # TODO: We will rename the file for now. We don't want lost work.
+ try:
+ os.rename(fname, fname + ".bak")
+ except:
+ pass # Just keep it if anything went wrong
# slip
if board["slip"] != '0':