Skip to content

Commit

Permalink
making WordPress migration script work: lib path fixes, some newbies'…
Browse files Browse the repository at this point in the history
… prints, and speacial WP URL fixes.
  • Loading branch information
menny authored and detro committed Mar 16, 2011
1 parent be3102a commit cbd91cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
9 changes: 6 additions & 3 deletions migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ def _convert_post_node(self, node, channel_link):
else:
post['published'] = self._parse_date(self._get_text(node, 'post_date',
ns=self.ns_wordpress))
post['path'] = self._get_text(node, 'link')[len(channel_link):] or None
post_wp_path = self._get_text(node, 'link')[len(channel_link):] or None
post_wp_path = post_wp_path.replace("?", "")
post_wp_path = post_wp_path.replace("=", "/")
post['path'] = post_wp_path

post['title'] = self._get_text(node, 'title') or None
post['body'] = self._expand_wp_tags(
self._get_text(node, 'encoded',
Expand Down Expand Up @@ -341,6 +345,5 @@ def migrate_all(self, batch_size=20, items=None):
deferred.defer(self.migrate_all, batch_size, items[batch_size:])
else:
logging.warn("Migration finished; starting rebuild.")
regen = post_deploy.PostRegenerator()
regen = post_deploy.ContentRegenerator()
deferred.defer(regen.regenerate)

24 changes: 16 additions & 8 deletions script/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import os
import sys

# Bloggart is currently based on Django 0.96
from google.appengine.dist import use_library
use_library('django', '0.96')
#To run this script, from the application root folder (where migrate.py is located):
#python script/remote.py

## Application specific
SDK_DIR = '/usr/local/google_appengine'
APP_DIR = '/home/aht/src/bloggart'
APPID = 'bloggart-demo'
EMAIL = 'my.email@host.dom'
#make sure the variables below are correct.
SDK_DIR = '/home/your_username/google_appengine'
APP_DIR = '/home/your_username/git/bloggart'
APPID = 'bloggart_GAE_app_ID'
EMAIL = 'your_email@example.com'

print "Your SDK folder is "+SDK_DIR;
print "If this is incorrect, edit remote.py to reflect the correct path!"

REMOTE_API_PATH = '/remote_api'

Expand All @@ -23,12 +26,17 @@
os.path.join(SDK_DIR, 'lib', 'antlr3'),
os.path.join(SDK_DIR, 'lib', 'django'),
os.path.join(SDK_DIR, 'lib', 'webob'),
os.path.join(SDK_DIR, 'lib', 'fancy_urllib'),
os.path.join(SDK_DIR, 'lib', 'yaml', 'lib'),
APP_DIR,
os.path.join(APP_DIR, 'lib'),
]
sys.path = EXTRA_PATHS + sys.path

# Bloggart is currently based on Django 0.96
from google.appengine.dist import use_library
use_library('django', '0.96')

from google.appengine.ext.remote_api import remote_api_stub

def attach(host=None):
Expand Down Expand Up @@ -73,4 +81,4 @@ def auth_func():
sys.ps1 = '%s <-- ' % (host or APPID)

import code
code.interact(banner=BANNER, local=globals())
code.interact(banner=BANNER, local=globals())

0 comments on commit cbd91cf

Please sign in to comment.