Merge lp:~dmascialino/encuentro/fix-1022274_markup_title into lp:encuentro

Proposed by Diego Mascialino
Status: Merged
Merge reported by: Facundo Batista
Merged at revision: not available
Proposed branch: lp:~dmascialino/encuentro/fix-1022274_markup_title
Merge into: lp:encuentro
Diff against target: 78 lines (+22/-19)
1 file modified
encuentro/main.py (+22/-19)
To merge this branch: bzr merge lp:~dmascialino/encuentro/fix-1022274_markup_title
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+113871@code.launchpad.net

Description of the change

Is necessary escape the Episode's title, because we show it in an markuped column

To post a comment you must log in.
Revision history for this message
Facundo Batista (facundo) wrote :

Gracias!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'encuentro/main.py'
2--- encuentro/main.py 2012-07-06 18:02:22 +0000
3+++ encuentro/main.py 2012-07-08 19:50:22 +0000
4@@ -20,6 +20,7 @@
5
6
7 import bz2
8+import cgi
9 import json
10 import logging
11 import os
12@@ -97,7 +98,7 @@
13 episode_id, url, state=None, progress=None, filename=None):
14 self.channel = channel
15 self.section = section
16- self.title = title
17+ self.title = cgi.escape(title)
18 self.duration = duration
19 self.description = description
20 self.episode_id = episode_id
21@@ -108,6 +109,19 @@
22 self.to_filter = None
23 self.set_filter()
24
25+ def update(self, channel, section, title, duration, description,
26+ episode_id, url, state=None, progress=None, filename=None):
27+ self.channel = channel
28+ self.section = section
29+ self.title = cgi.escape(title)
30+ self.duration = duration
31+ self.description = description
32+ self.episode_id = episode_id
33+ self.url = url
34+ self.state = Status.none if state is None else state
35+ self.progress = progress
36+ self.filename = filename
37+
38 def set_filter(self):
39 """Set the data to filter later."""
40 self.to_filter = dict(
41@@ -614,30 +628,19 @@
42 def merge_episode_data(self, new_data):
43 """Merge new data to current programs data."""
44 for d in new_data:
45- # v1 of json file
46- channel = d['channel']
47- section = d['section']
48- title = d['title']
49- duration = d['duration']
50- description = d['description']
51+ # v2 of json file
52+ names = ['channel', 'section', 'title', 'duration', 'description',
53+ 'episode_id', 'url']
54+ values = dict((name, d[name]) for name in names)
55 episode_id = d['episode_id']
56- url = d['url']
57
58 try:
59- epis = self.programs_data[episode_id]
60+ ed = self.programs_data[episode_id]
61 except KeyError:
62- ed = EpisodeData(channel=channel, section=section, title=title,
63- duration=duration, description=description,
64- episode_id=episode_id, url=url)
65+ ed = EpisodeData(**values)
66 self.programs_data[episode_id] = ed
67 else:
68- epis.channel = channel
69- epis.section = section
70- epis.title = title
71- epis.duration = duration
72- epis.description = description
73- epis.url = url
74- epis.set_filter()
75+ ed.update(**values)
76
77 # refresh the treeview and save the data
78 self.refresh_treeview()

Subscribers

People subscribed via source and target branches