aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2015-02-28 22:14:38 +0100
committerpiernov <piernov@piernov.org>2015-02-28 22:14:38 +0100
commitd97d99592ed6c69f996a782a7927101b5aeb1351 (patch)
tree39db7b97c4651dd785369713ee779d2b61787133
parent385971456e6cbdab055263d717023c5cb17ab72a (diff)
downloadjm2l-d97d99592ed6c69f996a782a7927101b5aeb1351.tar.gz
jm2l-d97d99592ed6c69f996a782a7927101b5aeb1351.tar.bz2
jm2l-d97d99592ed6c69f996a782a7927101b5aeb1351.tar.xz
jm2l-d97d99592ed6c69f996a782a7927101b5aeb1351.zip
Use // syntax for integer division
-rw-r--r--jm2l/captcha.py6
-rw-r--r--jm2l/upload.py8
2 files changed, 7 insertions, 7 deletions
diff --git a/jm2l/captcha.py b/jm2l/captcha.py
index bebc8bb..192e51b 100644
--- a/jm2l/captcha.py
+++ b/jm2l/captcha.py
@@ -48,8 +48,8 @@ class _PyCaptcha_WarpBase(object):
def render(self, image):
r = self.resolution
- xPoints = image.size[0] / r + 2
- yPoints = image.size[1] / r + 2
+ xPoints = image.size[0] // r + 2
+ yPoints = image.size[1] // r + 2
f = self.get_transform(image)
# Create a list of arrays with transformed points
@@ -124,7 +124,7 @@ def DoCaptcha(request):
# Choose a word for captcha
text = random.choice(TabMots)
Xt, Yt = font.getsize(text)
- OrX, OrY = (ImgSize[0]-Xt)/2, (ImgSize[1]-Yt)/2
+ OrX, OrY = (ImgSize[0]-Xt)//2, (ImgSize[1]-Yt)//2
draw.text((OrX, OrY), text, font=font, fill="#000000")
# Apply a Blur
# WorkImg=WorkImg.filter(ImageFilter.BLUR)
diff --git a/jm2l/upload.py b/jm2l/upload.py
index a1eadc0..cbbbfff 100644
--- a/jm2l/upload.py
+++ b/jm2l/upload.py
@@ -180,7 +180,7 @@ class MediaUpload(MediaPath):
timage = Image.new('RGBA', (THUMBNAIL_SIZE, THUMBNAIL_SIZE), (255, 255, 255, 0))
timage.paste(
image,
- ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
+ ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2))
TargetFileName = self.thumbnailpath(filename)
timage.save( TargetFileName )
return self.thumbnailurl( os.path.basename(TargetFileName) )
@@ -197,7 +197,7 @@ class MediaUpload(MediaPath):
# Add thumbnail
timage.paste(
image,
- ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
+ ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2))
# Stamp with PDF file type
timage.paste(
pdf_indicator,
@@ -225,13 +225,13 @@ class MediaUpload(MediaPath):
('Impress','odp'),
('Calc','ods'),
('Draw','odg')]
- stampfilename = filter(lambda (x,y): ext.endswith(y), istamp)
+ stampfilename = filter(lambda x,y : ext.endswith(y), istamp)
stamp = Image.open( "jm2l/static/img/%s-icon.png" % stampfilename[0][0])
timage = Image.new('RGBA', (THUMBNAIL_SIZE, THUMBNAIL_SIZE), (255, 255, 255, 0))
# Add thumbnail
timage.paste(
image,
- ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
+ ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2))
# Stamp with PDF file type
timage.paste(
stamp,