Strip PEP info at the network level.

(Currently it is done at the UI level in many, many different places)
This commit is contained in:
Stephan Erb 2009-11-14 23:07:22 +01:00
parent 3d5e8cc427
commit 088916f4e7
1 changed files with 16 additions and 10 deletions

View File

@ -236,10 +236,11 @@ class UserMoodPEP(AbstractPEP):
mood_tag = item.getTag('mood') mood_tag = item.getTag('mood')
if mood_tag: if mood_tag:
for child in mood_tag.getChildren(): for child in mood_tag.getChildren():
if child.getName() == 'text': name = child.getName().strip()
if name == 'text':
mood_dict['text'] = child.getData() mood_dict['text'] = child.getData()
elif child.getName() in MOODS : elif name in MOODS :
mood_dict['mood'] = child.getName() mood_dict['mood'] = name
retracted = items.getTag('retract') or not mood_dict retracted = items.getTag('retract') or not mood_dict
return (mood_dict, retracted) return (mood_dict, retracted)
@ -276,8 +277,10 @@ class UserTunePEP(AbstractPEP):
tune_tag = item.getTag('tune') tune_tag = item.getTag('tune')
if tune_tag: if tune_tag:
for child in tune_tag.getChildren(): for child in tune_tag.getChildren():
name = child.getName().strip()
data = child.getData().strip()
if child.getName() in TUNE_DATA: if child.getName() in TUNE_DATA:
tune_dict[child.getName()] = child.getData() tune_dict[name] = data
retracted = items.getTag('retract') or not tune_dict retracted = items.getTag('retract') or not tune_dict
return (tune_dict, retracted) return (tune_dict, retracted)
@ -315,13 +318,16 @@ class UserActivityPEP(AbstractPEP):
activity_tag = item.getTag('activity') activity_tag = item.getTag('activity')
if activity_tag: if activity_tag:
for child in activity_tag.getChildren(): for child in activity_tag.getChildren():
if child.getName() == 'text': name = child.getName().strip()
activity_dict['text'] = child.getData() data = child.getData().strip()
elif child.getName() in ACTIVITIES: if name == 'text':
activity_dict['activity'] = child.getName() activity_dict['text'] = data
elif name in ACTIVITIES:
activity_dict['activity'] = name
for subactivity in child.getChildren(): for subactivity in child.getChildren():
if subactivity.getName() in ACTIVITIES[child.getName()]: subactivity_name = subactivity.getName().strip()
activity_dict['subactivity'] = subactivity.getName() if subactivity_name in ACTIVITIES[name]:
activity_dict['subactivity'] = subactivity_name
retracted = items.getTag('retract') or not activity_dict retracted = items.getTag('retract') or not activity_dict
return (activity_dict, retracted) return (activity_dict, retracted)