Merge lp:~dholbach/developer-ubuntu-com/1506861 into lp:developer-ubuntu-com

Proposed by Daniel Holbach on 2015-10-29
Status: Merged
Approved by: David Callé on 2015-10-29
Approved revision: 159
Merged at revision: 158
Proposed branch: lp:~dholbach/developer-ubuntu-com/1506861
Merge into: lp:developer-ubuntu-com
Diff against target: 41 lines (+6/-2)
2 files modified
developer_portal/management/commands/import-external-docs-branches.py (+5/-1)
requirements.txt (+1/-1)
To merge this branch: bzr merge lp:~dholbach/developer-ubuntu-com/1506861
Reviewer Review Type Date Requested Status
David Callé 2015-10-29 Approve on 2015-10-29
Michael Hall 2015-10-29 Pending
Ubuntu App Developer site developers 2015-10-29 Pending
Review via email: mp+276104@code.launchpad.net

Commit Message

Fix the messed up article tree after markdown article import:
 - require fresh mptt (0.7.4)
 - run 'cms fix-mptt' management command after import
Thanks a lot Daniele Procida.

Description of the Change

Fix the messed up article tree after markdown article import:
 - require fresh mptt (0.7.4)
 - run 'cms fix-mptt' management command after import
Thanks a lot Daniele Procida.

To test either try the debug branch in https://bugs.launchpad.net/developer-ubuntu-com/+bug/1506861 or using an existing developer site branch. Then add some entries like
1|lp:snapcraft|snappy/snapcraft|intro.md
2|lp:snappy/15.04|snappy/guides/current|
3|lp:snappy|snappy/guides/devel|
to the external doc branches in the admin interface and run

 and run:
 - ./env/bin/pip -r requirements.txt install # don't use --upgrade as it'll
                                                      # try to install a newer Django(???)
 - ./env/bin/python2.7 manage.py import import-external-docs-branches

Go to the list of pages and see how they're all in the right place.

This will require us to update the pip cache and stuff.

To post a comment you must log in.
159. By Daniel Holbach on 2015-10-29

move 'cms fix-mptt' out of the d'tor

David Callé (davidc3) wrote :

Yes!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'developer_portal/management/commands/import-external-docs-branches.py'
2--- developer_portal/management/commands/import-external-docs-branches.py 2015-09-07 15:28:42 +0000
3+++ developer_portal/management/commands/import-external-docs-branches.py 2015-10-29 14:50:54 +0000
4@@ -1,4 +1,5 @@
5 from django.core.management.base import BaseCommand
6+from django.core.management import call_command
7 from django.db import transaction
8
9 from cms.api import create_page, add_plugin
10@@ -32,7 +33,7 @@
11 def remove_page(self, page_id):
12 self.removed_pages += [page_id]
13
14- @transaction.commit_on_success() # XXX: using=database
15+ @transaction.commit_on_success()
16 def run(self):
17 for added_page in self.added_pages:
18 page = get_or_create_page(**added_page)
19@@ -42,6 +43,9 @@
20 Page.objects.filter(id__in=self.removed_pages,
21 created_by="script").delete()
22
23+ # https://stackoverflow.com/questions/33284171/
24+ call_command('cms', 'fix-mptt')
25+
26
27 class MarkdownFile:
28 html = None
29
30=== modified file 'requirements.txt'
31--- requirements.txt 2015-08-31 13:12:54 +0000
32+++ requirements.txt 2015-10-29 14:50:54 +0000
33@@ -20,7 +20,7 @@
34 django-meta==0.2.0
35 django-meta-mixin==0.1.1
36 django-missing==0.1.13
37-django-mptt==0.6.1
38+django-mptt==0.7.4
39 django-parler==1.1.1
40 django-polymorphic==0.6
41 django-reversion==1.8.4

Subscribers

People subscribed via source and target branches