def __init__(self, wiki_name, queue, file, file_lock, **kwargs): self.queue = queue self.file = file self.file_lock = file_lock # Create a local db connection self.request = request.RequestDummy(wiki_name=wiki_name) super(Serializer, self).__init__()
We do this in chunks because loading an entire wiki into memory is kinda a bad idea. """ if not wiki_name: # TODO: full export return f = open('%s.%s.users.xml' % (wiki_name, time.time()), 'w') xml_header = ('<?xml version="1.0" encoding="UTF-8"?>\n' '<sycamore>\n' '<users>\n') xml_footer = '</users>\n</sycamore>' f.write(xml_header) users(request, f) f.write(xml_footer) f.close() if __name__ == '__main__': command_line = True sys.stdout.write("Enter the wiki shortname: ") wiki_name = raw_input().strip().lower() req = request.RequestDummy(wiki_name=wiki_name) export(req, wiki_name=wiki_name) req.db_disconnect()