~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/script/migration/_conv160.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
                pagename = kvdict.get('pagename')
109
109
                if pagename and ('PAGE', pagename) in self.renames:
110
110
                    kvdict['pagename'] = self.renames[('PAGE', pagename)]
111
 
                kvpairs = wikiutil.makeQueryString(kvdict)
 
111
                kvpairs = wikiutil.makeQueryString(kvdict, want_unicode=False)
112
112
                fields = str(timestamp), action, kvpairs
113
113
                line = '\t'.join(fields) + '\n'
114
114
                f.write(line)
131
131
        """ read complete edit-log from disk """
132
132
        data = {}
133
133
        try:
134
 
            lineno = 0
135
134
            f = file(self.fname, 'r')
136
135
            for line in f:
137
 
                lineno += 1
138
136
                line = line.replace('\r', '').replace('\n', '')
139
137
                if not line.strip(): # skip empty lines
140
138
                    continue
141
139
                fields = line.split('\t') + [''] * 9
142
140
                timestamp, rev, action, pagename, ip, hostname, userid, extra, comment = fields[:9]
143
 
                try:
144
 
                    timestamp = int(timestamp)
145
 
                    rev = int(rev)
146
 
                except ValueError, err:
147
 
                    print "Error: %r has a damaged timestamp or revision number in log line %d [%s] - skipping this entry" % (
148
 
                        self.fname, lineno, str(err))
149
 
                    continue # ignore this line, do not terminate - to find all those errors in one go
 
141
                timestamp = int(timestamp)
 
142
                rev = int(rev)
150
143
                pagename = wikiutil.unquoteWikiname(pagename)
151
144
                data[(timestamp, rev, pagename)] = (timestamp, rev, action, pagename, ip, hostname, userid, extra, comment)
152
145
            f.close()