@@ -19,7 +19,7 @@ def parse_args():
1919 p .add_argument ('--root' , help = 'Repository root (defaults to parent of scripts dir)' )
2020 p .add_argument ('--dry-run' , action = 'store_true' , help = "Don't write; only show what would be done" )
2121 p .add_argument ('--force' , action = 'store_true' , help = 'Allow destructive writes' )
22- return p .parse_args ()
22+ return p .parse_known_args ()[ 0 ]
2323
2424
2525def main ():
@@ -56,11 +56,23 @@ def main():
5656 continue
5757
5858 try :
59- wr = WikiRevision .create (wp ._id , content , author = system_user , reason = 'Import from docs/policies' )
59+ wr = WikiRevision .create (wp ._id , content , author = system_user . _id36 , reason = 'Import from docs/policies' )
6060 print ('Created revision' , getattr (wr , '_id' , None ))
61+ # Update the WikiPage to point at the new revision so that
62+ # revise() won't skip it next time due to stale content.
63+ wp .content = content
64+ wp .revision = str (wr ._id )
65+ wp .last_edit_by = system_user ._id36
66+ wp ._commit ()
67+ print ('Updated WikiPage' , wiki_name )
6168 except Exception as e :
69+ import traceback
70+ traceback .print_exc ()
6271 print ('Failed create for' , wiki_name , e )
6372
6473
6574if __name__ == '__main__' :
6675 main ()
76+ else :
77+ # When loaded via tippr-run or paster run, execute main automatically
78+ main ()
0 commit comments