incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [14/29] git commit: [#5289] provide migration script for existing trove category data
Date Tue, 04 Dec 2012 14:26:14 GMT
[#5289] provide migration script for existing trove category data


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

Branch: refs/heads/tv/5382
Commit: d4fe36c6de8e83c6830217e54a16128835518157
Parents: 3a0ffde
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Dec 3 22:04:55 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Dec 3 22:20:24 2012 +0000

----------------------------------------------------------------------
 scripts/migrations/030-set-trove-show_as_skill.py |   21 ++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d4fe36c6/scripts/migrations/030-set-trove-show_as_skill.py
----------------------------------------------------------------------
diff --git a/scripts/migrations/030-set-trove-show_as_skill.py b/scripts/migrations/030-set-trove-show_as_skill.py
new file mode 100644
index 0000000..b95e99a
--- /dev/null
+++ b/scripts/migrations/030-set-trove-show_as_skill.py
@@ -0,0 +1,21 @@
+import re
+
+from allura import model as M
+
+
+def main():
+    categories_regex = '|'.join([
+        'Translations',
+        'Programming Language',
+        'User Interface',
+        'Database Environment',
+        'Operating System',
+        'Topic',
+    ])
+    M.TroveCategory.query.update(
+        {'fullname': re.compile(r'^(%s)' % categories_regex)},
+        {'$set': {'show_as_skill': True}},
+        multi=True)
+
+if __name__ == '__main__':
+    main()


Mime
View raw message