Child: [bea16d] (diff)

Download this file

020-remove-wiki-title-slashes.py    22 lines (15 with data), 506 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import logging
from pylons import c
from ming.orm import ThreadLocalORMSession
from forgewiki import model as WM
log = logging.getLogger(__name__)
def main():
c.project = None
pages = WM.Page.query.find({'title': {'$regex': '\/'}}).all()
print 'Found %s wiki titles containing "/"...' % len(pages)
for page in pages:
page.title = page.title.replace('/', '-')
print 'Updated: %s' % page.title
ThreadLocalORMSession.flush_all()
if __name__ == '__main__':
main()