Skip to content

Commit

Permalink
Merge remote branch 'jezdez/master'
Browse files Browse the repository at this point in the history
Conflicts:
	setup.py
  • Loading branch information
brosner committed Mar 16, 2010
2 parents b948422 + afadde4 commit 1111e79
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 62 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include LICENSE.txt
include CONTRIBUTORS.txt
recursive-include docs *
recursive-include avatar/templates/avatar *.html
recursive-include avatar/templates/avatar *.html
recursive-include avatar/locale/*/LC_MESSAGES *.mo *.po
1 change: 1 addition & 0 deletions avatar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AVATAR_MAX_AVATARS_PER_USER = getattr(settings, 'AVATAR_MAX_AVATARS_PER_USER', 42)
AVATAR_MAX_SIZE = getattr(settings, 'AVATAR_MAX_SIZE', 1024 * 1024)
AVATAR_THUMB_FORMAT = getattr(settings, 'AVATAR_THUMB_FORMAT', "JPEG")
AVATAR_THUMB_QUALITY = getattr(settings, 'AVATAR_THUMB_QUALITY', 85)
AVATAR_HASH_FILENAMES = getattr(settings, 'AVATAR_HASH_FILENAMES', False)
AVATAR_HASH_USERDIRNAMES = getattr(settings, 'AVATAR_HASH_USERDIRNAMES', False)
AVATAR_ALLOWED_FILE_EXTS = getattr(settings, 'AVATAR_ALLOWED_FILE_EXTS', None)
Expand Down
Binary file added avatar/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
131 changes: 131 additions & 0 deletions avatar/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-03-16 15:19+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

#: forms.py:33
#, python-format
msgid ""
"%(ext)s is an invalid file extension. Authorized extensions are : %"
"(valid_exts_list)s"
msgstr ""
"%(ext)s ist ein ungültiges Dateiformat. Erlaubte Formate sind: %"
"(valid_exts_list)s"

#: forms.py:37
#, python-format
msgid ""
"Your file is too big (%(size)s), the maximum allowed size is %"
"(max_valid_size)s"
msgstr ""
"Die Datei ist zu groß (%(size)s), die Maximalgröße ist %(max_valid_size)s"

#: forms.py:43
#, python-format
msgid ""
"You already have %(nb_avatars)d avatars, and the maximum allowed is %"
"(nb_max_avatars)d."
msgstr ""
"Sie haben bereits %(nb_avatars)d Avatarbilder hochgeladen. Das maximale "
"Anzahl ist %(nb_max_avatars)d."

#: models.py:71
#, python-format
msgid "Avatar for %s"
msgstr "Avatar für %s"

#: views.py:90
msgid "Successfully uploaded a new avatar."
msgstr "Erfolgreich einen neuen Avatar hochgeladen."

#: views.py:128
msgid "Successfully updated your avatar."
msgstr "Erfolgreich Ihren Avatar aktualisiert."

#: views.py:166
msgid "Successfully deleted the requested avatars."
msgstr "Erfolgreich den Avatar gelöscht."

#: management/__init__.py:9
msgid "Avatar Updated"
msgstr "Avatar aktualisiert"

#: management/__init__.py:9
msgid "your avatar has been updated"
msgstr "Ihr Avatar wurde aktualisiert"

#: management/__init__.py:10
msgid "Friend Updated Avatar"
msgstr "Freund aktualisierte Avatar"

#: management/__init__.py:10
msgid "a friend has updated their avatar"
msgstr "Avatar eines Freundes wurde aktualisiert"

#: templates/avatar/add.html:5 templates/avatar/change.html:5
msgid "Your current avatar: "
msgstr "Ihr aktueller Avatar: "

#: templates/avatar/add.html:8 templates/avatar/change.html:8
msgid "You haven't uploaded an avatar yet. Please upload one now."
msgstr ""
"Sie haben noch keinen Avatar hochgeladen. Bitte laden Sie nun einen hoch."

#: templates/avatar/add.html:12 templates/avatar/change.html:19
msgid "Upload New Image"
msgstr "Neues Bild hochladen"

#: templates/avatar/change.html:14
msgid "Choose new Default"
msgstr "Standard auswählen"

#: templates/avatar/confirm_delete.html:5
msgid "Please select the avatars that you would like to delete."
msgstr "Bitte wählen Sie die Avatar aus, die Sie löschen möchten."

#: templates/avatar/confirm_delete.html:8
#, python-format
msgid ""
"You have no avatars to delete. Please <a href=\"%(avatar_change_url)s"
"\">upload one</a> now."
msgstr ""
"Sie haben keine Avatare zum Löschen. Bitte <a href=\"%(avatar_change_url)s"
"\">laden Sie einen hoch</a>."

#: templates/avatar/confirm_delete.html:14
msgid "Delete These"
msgstr "Auswahl löschen"

#: templates/notification/avatar_friend_updated/notice.html:2
#, python-format
msgid ""
"<a href=\"%(user_url)s\">%(avatar_creator)s</a> has updated their avatar <a "
"href=\"%(avatar_url)s\">%(avatar)s</a>."
msgstr ""
"<a href=\"%(user_url)s\">%(avatar_creator)s</a> hat den Avatar aktualisiert "
"<a href=\"%(avatar_url)s\">%(avatar)s</a>."

#: templates/notification/avatar_updated/notice.html:2
#, python-format
msgid "You have updated your avatar <a href=\"%(avatar_url)s\">%(avatar)s</a>."
msgstr ""
"Sie haben Ihren Avatar aktualisiert <a href=\"%(avatar_url)s\">%(avatar)s</"
"a>."

#: templatetags/avatar_tags.py:40
msgid "Default Avatar"
msgstr "Standard-Avatar"
Binary file added avatar/locale/pt_BR/LC_MESSAGES/django.mo
Binary file not shown.
68 changes: 68 additions & 0 deletions avatar/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-09 04:13-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: models.py:32
#, python-format
msgid "Avatar for %s"
msgstr "Avatar para %s"

#: views.py:68
msgid "Successfully uploaded a new avatar."
msgstr "Nova foto de perfil enviada com sucesso."

#: views.py:76
msgid "Successfully updated your avatar."
msgstr "Sua foto de perfil foi atualizada com sucesso."

#: views.py:114
msgid "Successfully deleted the requested avatars."
msgstr "As fotos de perfil selecionadas foram excluídas com sucesso."

#: management/__init__.py:9
msgid "Avatar Updated"
msgstr "Foto de Perfil Atualizada"

#: management/__init__.py:9
msgid "avatar have been updated"
msgstr "foto de perfil foi atualizada"

#: management/__init__.py:10
msgid "Friend Updated Avatar"
msgstr "Amigo Atualizou Foto de Perfil"

#: management/__init__.py:10
msgid "a friend has updated his avatar"
msgstr "um amigo atualizou a foto de perfil"

#: templates/notifications/avatar_friend_updated/notice.html:2
#, python-format
msgid ""
"<a href=\"%(user_url)s\">%(avatar_creator)s</a> has updated his avatar <a "
"href=\"%(avatar_url)s\">%(avatar)s</a>."
msgstr ""
"<a href=\"%(user_url)s\">%(avatar_creator)s</a> atualizou a foto de perfil <a "
"href=\"%(avatar_url)s\">%(avatar)s</a>."

#: templates/notifications/avatar_updated/notice.html:2
#, python-format
msgid "A new tribe <a href=\"%(avatar_url)s\">%(avatar)s</a> has been created."
msgstr "Uma nova foto de perfil <a href=\"%(avatar_url)s\">%(avatar)s</a> foi criada."

#: templatetags/avatar_tags.py:47
msgid "Default Avatar"
msgstr "Foto de Perfil Padrão"
8 changes: 5 additions & 3 deletions avatar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

from avatar import AVATAR_STORAGE_DIR, AVATAR_RESIZE_METHOD, \
AVATAR_MAX_AVATARS_PER_USER, AVATAR_THUMB_FORMAT, \
AVATAR_HASH_USERDIRNAMES, AVATAR_HASH_FILENAMES
AVATAR_HASH_USERDIRNAMES, AVATAR_HASH_FILENAMES, \
AVATAR_THUMB_QUALITY

def avatar_file_path(instance=None, filename=None, size=None, ext=None):
tmppath = [AVATAR_STORAGE_DIR]
Expand Down Expand Up @@ -82,12 +83,13 @@ def save(self, force_insert=False, force_update=False):
def thumbnail_exists(self, size):
return self.avatar.storage.exists(self.avatar_name(size))

def create_thumbnail(self, size):
def create_thumbnail(self, size, quality=None):
try:
orig = self.avatar.storage.open(self.avatar.name, 'rb').read()
image = Image.open(StringIO(orig))
except IOError:
return # What should we do here? Render a "sorry, didn't work" img?
quality = quality or AVATAR_THUMB_QUALITY
(w, h) = image.size
if w != size or h != size:
if w > h:
Expand All @@ -100,7 +102,7 @@ def create_thumbnail(self, size):
if image.mode != "RGB":
image = image.convert("RGB")
thumb = StringIO()
image.save(thumb, AVATAR_THUMB_FORMAT)
image.save(thumb, AVATAR_THUMB_FORMAT, quality=quality)
thumb_file = ContentFile(thumb.getvalue())
else:
thumb_file = ContentFile(orig)
Expand Down
8 changes: 4 additions & 4 deletions avatar/templates/avatar/add.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "avatar/base.html" %}
{% load avatar_tags %}
{% load i18n avatar_tags %}

{% block content %}
<p>Your current avatar: </p>
<p>{% trans "Your current avatar: " %}</p>
{% avatar user %}
{% if not avatars %}
<p>You haven't uploaded an avatar yet. Please upload one now.</p>
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% endif %}
<form enctype="multipart/form-data" method="POST" action="{% url avatar_add %}">
{{ upload_avatar_form.as_p }}
<p><input type="submit" value="Upload New Image" /></p>
<p><input type="submit" value="{% trans "Upload New Image" %}" /></p>
</form>
{% endblock %}
10 changes: 5 additions & 5 deletions avatar/templates/avatar/change.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{% extends "avatar/base.html" %}
{% load avatar_tags %}
{% load i18n avatar_tags %}

{% block content %}
<p>Your current avatar: </p>
<p>{% trans "Your current avatar: " %}</p>
{% avatar user %}
{% if not avatars %}
<p>You haven't uploaded an avatar yet. Please upload one now.</p>
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% else %}
<form method="POST" action="{% url avatar_change %}">
<ul>
{{ primary_avatar_form.as_ul }}
</ul>
<input type="submit" value="Choose new Default" />
<input type="submit" value="{% trans "Choose new Default" %}" />
</form>
{% endif %}
<form enctype="multipart/form-data" method="POST" action="{% url avatar_add %}">
{{ upload_avatar_form.as_p }}
<p><input type="submit" value="Upload New Image" /></p>
<p><input type="submit" value="{% trans "Upload New Image" %}" /></p>
</form>
{% endblock %}
8 changes: 5 additions & 3 deletions avatar/templates/avatar/confirm_delete.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{% extends "avatar/base.html" %}
{% load i18n %}

{% block content %}
<p>Please select the avatars that you would like to delete.</p>
<p>{% trans "Please select the avatars that you would like to delete." %}</p>
{% if not avatars %}
<p>You have no avatars to delete. Please <a href="{% url avatar_change %}">upload one</a> now.</p>
{% url avatar_change as avatar_change_url %}
<p>{% blocktrans %}You have no avatars to delete. Please <a href="{{ avatar_change_url }}">upload one</a> now.{% endblocktrans %}</p>
{% else %}
<form method="POST" action="{% url avatar_delete %}">
<ul>
{{ delete_avatar_form.as_ul }}
</ul>
<input type="submit" value="Delete These" />
<input type="submit" value="{% trans "Delete These" %}" />
</form>
{% endif %}
{% endblock %}
Loading

0 comments on commit 1111e79

Please sign in to comment.