Back to index

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

Functions

def convert_textdir
def convert_pagedir
def convert_editlog

Variables

string origdir = 'data.pre-mig3'

Function Documentation

def MoinMoin.script.old.migration.12_to_13_mig03.convert_editlog (   file_from,
  file_to,
  dir_to 
)

Definition at line 101 of file 12_to_13_mig03.py.

00101 
00102 def convert_editlog(file_from, file_to, dir_to):
00103     for l in open(file_from):
00104         data = l.split('\t')
00105         pagename = data[0]
00106         timestamp = data[2]
00107         data[2] = str(long(float(timestamp))) # we only want integer (must be long for py 2.2.x)
00108         data = '\t'.join(data)
00109 
00110         f = open(file_to, 'a')
00111         f.write(data)
00112         f.close()
00113 
00114         try:
00115             file_to2 = opj(dir_to, pagename, 'edit-log')
00116             f = open(file_to2, 'a')
00117             f.write(data)
00118             f.close()
00119         except: pass
00120 
00121 # Backup original dir and create new empty dir
00122 try:
00123     os.rename('data', origdir)
    os.mkdir('data')

Here is the call graph for this function:

Definition at line 90 of file 12_to_13_mig03.py.

00090 
00091 def convert_pagedir(dir_from, dir_to):
00092     os.mkdir(dir_to)
00093     for dname_from in listdir(dir_from):
00094         print "%s" % (dname_from, )
00095         dname_to = dname_from
00096         shutil.copytree(opj(dir_from, dname_from), opj(dir_to, dname_to), 1)
00097         try:
00098             os.remove(opj(dir_to, dname_to, 'last-edited'))
00099         except: pass
00100 

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.script.old.migration.12_to_13_mig03.convert_textdir (   dir_from,
  dir_to,
  is_backupdir = 0 
)

Definition at line 60 of file 12_to_13_mig03.py.

00060 
00061 def convert_textdir(dir_from, dir_to, is_backupdir=0):
00062     for fname_from in listdir(dir_from):
00063         if is_backupdir:
00064             fname, timestamp = fname_from.split('.')
00065         else:
00066             fname = fname_from
00067         try:
00068             os.mkdir(opj(dir_to, 'pages', fname))
00069         except: pass
00070         try:
00071             os.mkdir(opj(dir_to, 'pages', fname, 'backup'))
00072         except: pass
00073         try:
00074             os.mkdir(opj(dir_to, 'pages', fname, 'cache'))
00075         except: pass
00076         if is_backupdir:
00077             fname_to = opj('pages', fname, 'backup', timestamp)
00078         else:
00079             fname_to = opj('pages', fname, 'text')
00080         copy_file(opj(dir_from, fname_from), opj(dir_to, fname_to))
00081 
00082         #we don't have cache, mig2 doesn't convert it
00083         #try:
00084         #    cache_from = opj(origdir,'cache','charts','hitcounts-%s' % fname)
00085         #    cache_to = opj(dir_to, 'pages', fname, 'cache', 'hitcounts')
00086         #    if os.path.exists(cache_from):
00087         #        copy_file(cache_from, cache_to)
00088         #except: pass
00089 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 58 of file 12_to_13_mig03.py.