def start(self): feed = UnicodeDict() feed.url = self.prefix_dest('index.html') feed.feedurl = self._output feed.posts = g.public_posts[:settings.config['feedcount']] dest = os.path.join(g.output_directory, self._output) self.render({'feed': feed}, self._template, dest)
def start(self): for category in self._posts: feed = UnicodeDict() feed.url = self.prefix_dest('%s/index.html' % category) feed.feedurl = self.prefix_dest('%s/%s' % (category, self._output)) feed.posts = self._posts[category][:settings.config['feedcount']] dest = os.path.join(g.output_directory, feed.feedurl) self.render({'feed': feed}, self._template, dest)
def start(self): feed = UnicodeDict() feed.url = self.prefix_dest('index.html') feed.feedurl = self._output feed.posts = g.public_posts[:settings.feedcount] dest = os.path.join(g.output_directory, self._output) self.render({'feed': feed}, self._template, dest)
def start(self): for category in self._posts: feed = UnicodeDict() feed.url = self.prefix_dest('%s/index.html' % category) feed.feedurl = self.prefix_dest('%s/%s' % (category, self._output)) feed.posts = self._posts[category][:settings.feedcount] dest = os.path.join(g.output_directory, feed.feedurl) self.render({'feed': feed}, self._template, dest)
def init_config(filepath): config = ConfigParser() config.read(filepath) for sec in config.sections(): if sec in ('site', 'context', 'writers', 'readers', 'filters'): ns[sec].update(config.items(sec)) elif '_data' in sec: ns.data[sec] = UnicodeDict(config.items(sec)) else: ns.sections[sec] = UnicodeDict(config.items(sec)) return config
def on_message(self, message): """Handshake with livereload.js 1. client send 'hello' 2. server reply 'hello' 3. client send 'info' http://help.livereload.com/kb/ecosystem/livereload-protocol """ message = UnicodeDict(escape.json_decode(message)) if message.command == 'hello': handshake = {} handshake['command'] = 'hello' protocols = message.protocols protocols.append( 'http://livereload.com/protocols/2.x-remote-control' ) handshake['protocols'] = protocols handshake['serverName'] = 'livereload-tornado' self.send_message(handshake) if message.command == 'info' and 'url' in message: logging.info('Browser Connected: %s' % message.url) LiveReloadHandler.waiters.add(self) if not LiveReloadHandler._watch_running: LiveReloadHandler._watch_running = True logging.info('Start watching changes') tornado.ioloop.PeriodicCallback(self.watch_tasks, 500).start()
def init_config(filepath): config = ConfigParser() config.read(filepath) for sec in config.sections(): if sec in ('site', 'context', 'writers', 'readers', 'filters'): ns[sec].update(config.items(sec)) elif sec not in ('title', 'post', 'status', 'pager', 'tags'): ns.sections[sec] = UnicodeDict(config.items(sec)) return config