def _wordpress_page(self, id): from pywordpress import Wordpress import time url = str(config['ckan.site.wordpress.server']) password = config['ckan.site.wordpress.password'] user = config['ckan.site.wordpress.user'] wp = Wordpress(url, user, password) p = wp.get_page(id) return p
__FILENAME__ = download '''Retrieve current text from Wordpress. Uses the https://bitbucket.org/rgrp/pywordpress/src ''' import os from pywordpress import Wordpress w = Wordpress.init_from_config('config.ini') for p in w.get_page_list(): p = w.get_page(p['page_id']) if not p['wp_slug']: continue print 'Processing', p['wp_slug'], p['title'] path = os.path.join('cache', p['wp_slug'] + '.rst') heading = len(p['title']) * '=' text = '%s\n%s\n%s\n\n' % (heading, p['title'], heading) + p['description'] fo = open(path, 'w') text = text.encode('utf8') fo.write(text) fo.close() ########NEW FILE######## __FILENAME__ = conf # -*- coding: utf-8 -*- # # Open Data Handbook documentation build configuration file, created by # sphinx-quickstart on Wed Apr 6 11:00:35 2011. # # This file is execfile()d with the current directory set to its containing dir. #
__FILENAME__ = download '''Retrieve current text from Wordpress. Uses the https://bitbucket.org/rgrp/pywordpress/src ''' import os from pywordpress import Wordpress w = Wordpress.init_from_config('config.ini') for p in w.get_page_list(): p = w.get_page(p['page_id']) if not p['wp_slug']: continue print 'Processing', p['wp_slug'], p['title'] path = os.path.join('cache', p['wp_slug'] + '.rst') heading = len(p['title']) * '=' text = '%s\n%s\n%s\n\n' % (heading, p['title'], heading) + p['description'] fo = open(path, 'w') text = text.encode('utf8') fo.write(text) fo.close() ########NEW FILE######## __FILENAME__ = conf # -*- coding: utf-8 -*- # # Open Data Handbook documentation build configuration file, created by # sphinx-quickstart on Wed Apr 6 11:00:35 2011. # # This file is execfile()d with the current directory set to its containing dir.