[Python-checkins] r61282 - tracker/instances/python-dev/scripts/set_text_plain

martin.v.loewis python-checkins at python.org
Thu Mar 6 20:00:07 CET 2008


Author: martin.v.loewis
Date: Thu Mar  6 20:00:06 2008
New Revision: 61282

Added:
   tracker/instances/python-dev/scripts/set_text_plain
      - copied, changed from r61007, tracker/instances/python-dev/scripts/remove_py3k
Log:
Add script to set all patches to text/plain.


Copied: tracker/instances/python-dev/scripts/set_text_plain (from r61007, tracker/instances/python-dev/scripts/remove_py3k)
==============================================================================
--- tracker/instances/python-dev/scripts/remove_py3k	(original)
+++ tracker/instances/python-dev/scripts/set_text_plain	Thu Mar  6 20:00:06 2008
@@ -1,24 +1,17 @@
-# This sample script changes all issues with the
-# py3k keyword to using the "Python 3.0" version instead.
-import sys
+# This sample script changes all files with the
+# extensions .diff/.patch/.py to the text/plain type
+import sys, posixpath
 sys.path.insert(1,'/home/roundup/roundup/lib/python2.4/site-packages')
 import roundup.instance
 
 tracker = roundup.instance.open('.')
 db = tracker.open('admin')
 
-py3k = db.keyword.lookup('py3k')
-py30 = db.version.lookup('Python 3.0')
-
-using_py3k = db.issue.find(keywords={py3k:1})
-
-for issue in using_py3k:
-    keywords = db.issue.get(issue, 'keywords')
-    keywords.remove(py3k)
-    versions = db.issue.get(issue, 'versions')
-    versions.append(py30)
-
-    # Use set_inner, so that auditors and reactors don't fire
-    db.issue.set_inner(issue, keywords=keywords, versions=versions)
+tochange = []
+for fileid in db.file.getnodeids():
+    name = db.file.get(fileid, 'name')
+    if posixpath.splitext(name)[1] in ('.diff','.patch','.py'):
+        if db.file.get(fileid, 'type') != 'text/plain':
+            db.file.set_inner(fileid, type='text/plain')
 
 db.commit()


More information about the Python-checkins mailing list