def list_names(self):
return self.entries.keys()
- def add_entry(self, d):
- if d['name'] in self.entries:
+ def add_entry(self, d, force=False):
+ if d['name'] in self.entries and not force:
raise Exception('That name is already present')
else:
self.entries[d['name']] = d
cr = crawler.Crawler()
with open('/var/www/py/new.html.t', 'r') as f:
data = f.read()
+ html_feed = '<table id="content-table" border="1" id="htab">'
+ html_feed += '<tr><th>Title</th><th>Summary</th></tr><!--line-->'
+ for i in cr.entries[args['name']]['content']:
+ html_feed += ('<tr><td id="cel">{}</td><!--cel--><td id="cel">{}</'
+ 'td><!--cel--></tr><!--line-->').format(
+ i[0].decode('utf-8').encode('ascii', 'xmlcharrefreplace'),
+ i[1].decode('utf-8').encode('ascii', 'xmlcharrefreplace'))
params = {
'rssname': args['name'],
'url': cr.entries[args['name']]['url'],
'input_data': input_data(cr.entries[args['name']]),
- 'feed_html': str(cr.entries[args['name']]['content'])}
+ 'feed_html': html_feed
+ }
req.write(data.format(**params))
- # req.write('<table>')
- # req.write(''.join(
- # '<tr><td>{}</td><td>{}</td></tr>'.format(a[0], a[1])
- # for a in cr.entries[args['name']]['content']))
- # req.write('</table>')
else:
req.write('Unknown editing action: {}'.format(args['action']))
req.write('<br/><a href="index.py">Go back</a>')
return (
'\t\t<tr><td>Venue: </td><td>\n'
- '\t\t\t<input type="text" name="venue" class="indat" value="{venue}">\n'
+ '\t\t\t<input type="text" name="venue" '
+ 'class="indat" value="{venue}">\n'
'\t\t</td></tr><tr><td>Frequency: </td><td>\n'
'\t\t\t<input type="text" name="freq" class="indat" value="{freq}">\n'
'\t\t</td></tr><tr><td>Default location name: </td><td>\n'
'\t\t\t<input type="text" name="dloc" class="indat" value="{dloc}">\n'
'\t\t</td></tr><tr><td>Adress: </td><td>\n'
- '\t\t\t<input type="text" name="adress" class="indat" value="{adress}">\n'
+ '\t\t\t<input type="text" name="adress" '
+ 'class="indat" value="{adress}">\n'
'\t\t</td></tr><tr><td>Website: </td><td>\n'
- '\t\t\t<input type="text" name="website" class="indat" value="{website}">\n'
+ '\t\t\t<input type="text" name="website" '
+ 'class="indat" value="{website}">\n'
'\t\t</td></tr><tr><td>RSS URL: </td><td>\n'
'\t\t\t<input type="text" name="url" class="indat" value="{url}">\n'
'\t\t</td></tr>').format(**basicdict)