incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [3/8] git commit: [#4785] Fixes for changes from [#4637]
Date Tue, 02 Oct 2012 19:33:32 GMT
[#4785] Fixes for changes from [#4637]

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/37954c43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/37954c43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/37954c43

Branch: refs/heads/master
Commit: 37954c43448ae1a9714e7a4332f9d818651bf6c5
Parents: 473db38
Author: Cory Johns <johnsca@geek.net>
Authored: Tue Oct 2 16:35:53 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Oct 2 16:37:11 2012 +0000

----------------------------------------------------------------------
 .../forgeshorturl/command/migrate_urls.py          |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/37954c43/ForgeShortUrl/forgeshorturl/command/migrate_urls.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/command/migrate_urls.py b/ForgeShortUrl/forgeshorturl/command/migrate_urls.py
index 3019308..0f19c11 100644
--- a/ForgeShortUrl/forgeshorturl/command/migrate_urls.py
+++ b/ForgeShortUrl/forgeshorturl/command/migrate_urls.py
@@ -1,4 +1,5 @@
 import tg
+from pylons import tmpl_context as c
 from bson import ObjectId
 from forgeshorturl.command.base import ShortUrlCommand
 from forgeshorturl.model import ShortUrl
@@ -31,10 +32,13 @@ class MigrateUrls(ShortUrlCommand):
     def command(self):
         self.basic_setup()
         p_id = self.args[2]
-        p = M.Project.query.get(_id=ObjectId(p_id))
-        if not p:
+        mount_point = 'url'
+        c.project = M.Project.query.get(_id=ObjectId(p_id))
+        if not c.project:
             raise exceptions.NoSuchProjectError('The project %s '
                     'could not be found in the database' % p_id)
+        c.app = c.project.app_instance(mount_point)
+        assert c.app, 'Project does not have ShortURL app installed'
 
         db = sqlalchemy.create_engine(self._connection_string())
         meta = sqlalchemy.MetaData()
@@ -43,12 +47,11 @@ class MigrateUrls(ShortUrlCommand):
 
         for row in urls.select().execute():
             url = ShortUrl.upsert(h.really_unicode(row['short_id']))
-            url.url = h.really_unicode(row['url'])
+            url.full_url = h.really_unicode(row['url'])
             url.description = h.really_unicode(row['description'])
             url.private = row['private'] == 'Y'
             url.created = datetime.utcfromtimestamp(row['create_time'])
             url.last_updated = datetime.utcfromtimestamp(row['edit_time'])
-            url.project_id = p._id
             user = M.User.query.get(sfx_userid=row['create_user'])
             user_id = user._id if user else M.User.anonymous()._id
             url.create_user = user_id


Mime
View raw message