Move function closer to where it is used.

This makes it easier to reason about its usage.
This commit is contained in:
Stephan Erb 2009-11-22 22:14:05 +01:00
parent 07c008cbaa
commit 96b9326b0f
1 changed files with 7 additions and 7 deletions

View File

@ -204,12 +204,6 @@ from common import gajim
import gtkgui_helpers import gtkgui_helpers
def translate_mood(mood):
if mood in MOODS:
return MOODS[mood]
else:
return mood
class AbstractPEP(object): class AbstractPEP(object):
@ -293,13 +287,19 @@ class UserMoodPEP(AbstractPEP):
def asMarkupText(self): def asMarkupText(self):
assert not self._retracted assert not self._retracted
untranslated_mood = self._pep_specific_data['mood'] untranslated_mood = self._pep_specific_data['mood']
mood = translate_mood(untranslated_mood) mood = _translate_mood(untranslated_mood)
markuptext = '<b>%s</b>' % gobject.markup_escape_text(mood) markuptext = '<b>%s</b>' % gobject.markup_escape_text(mood)
if 'text' in self._pep_specific_data: if 'text' in self._pep_specific_data:
text = self._pep_specific_data['text'] text = self._pep_specific_data['text']
markuptext += ' (%s)' % gobject.markup_escape_text(text) markuptext += ' (%s)' % gobject.markup_escape_text(text)
return markuptext return markuptext
def _translate_mood(mood):
if mood in MOODS:
return MOODS[mood]
else:
return mood
class UserTunePEP(AbstractPEP): class UserTunePEP(AbstractPEP):
'''XEP-0118: User Tune''' '''XEP-0118: User Tune'''