Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.script.old.migration.12_to_13_mig07 Namespace Reference

Functions

def tocrlf
def process_pagedirs

Variables

string origdir = 'data.pre-mig7'

Function Documentation

Definition at line 44 of file 12_to_13_mig07.py.

00044 
00045 def process_pagedirs(dir_from, dir_to):
00046     pagelist = listdir(dir_from)
00047     for pagename in pagelist:
00048         pagedir_from = opj(dir_from, pagename)
00049         pagedir_to = opj(dir_to, pagename)
00050 
00051         # first we copy all, even the stuff we convert later:
00052         copy_dir(pagedir_from, pagedir_to)
00053 
00054         rev_from = opj(pagedir_from, 'revisions')
00055         rev_to = opj(pagedir_to, 'revisions')
00056         if os.path.exists(rev_from):
00057             revlist = listdir(rev_from)
00058             for rfile in revlist:
00059                 rev = int(rfile)
00060                 r_from = opj(rev_from, rfile)
00061                 r_to = opj(rev_to, rfile)
00062                 tocrlf(r_from, r_to)

Here is the call graph for this function:

rewrite a text file using CRLF for line endings, no matter what
    it was before.

Definition at line 26 of file 12_to_13_mig07.py.

00026 
00027 def tocrlf(fni, fno):
00028     """ rewrite a text file using CRLF for line endings, no matter what
00029         it was before.
00030     """
00031     fi = open(fni, "rb")
00032     data = fi.read()
00033     fi.close()
00034     data = data.replace("\r", "")
00035     lines = data.split("\n")
00036     data = "\r\n".join(lines)
00037     if data[-2:] != "\r\n":
00038         data += "\r\n"
00039     fo = open(fno, "wb")
00040     fo.write(data)
00041     fo.close()
00042     st = os.stat(fni)
00043     os.utime(fno, (st.st_atime, st.st_mtime))

Here is the caller graph for this function:


Variable Documentation

Definition at line 63 of file 12_to_13_mig07.py.