mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Replace use of onsecure tempfile in the bundled rtf2xml library. Fixes #885245 (Private bug)
This commit is contained in:
parent
0fc9a42975
commit
80a2c3c198
@ -11,10 +11,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy, check_brackets
|
||||
# note to self. This is the first module in which I use tempfile. A good idea?
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class AddBrackets:
|
||||
"""
|
||||
@ -39,7 +39,7 @@ class AddBrackets:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
|
||||
def __initiate_values(self):
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
"""
|
||||
Simply write the list of strings after style table
|
||||
"""
|
||||
@ -42,7 +44,7 @@ class BodyStyles:
|
||||
self.__copy = copy
|
||||
self.__list_of_styles = list_of_styles
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
# self.__write_to = 'table_info.data'
|
||||
def insert_info(self):
|
||||
"""
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Colors:
|
||||
"""
|
||||
@ -38,7 +39,7 @@ class Colors:
|
||||
self.__copy = copy
|
||||
self.__bug_handler = bug_handler
|
||||
self.__line = 0
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
|
||||
def __initiate_values(self):
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class CombineBorders:
|
||||
"""Combine borders in RTF tokens to make later processing easier"""
|
||||
@ -25,7 +26,7 @@ class CombineBorders:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__state = 'default'
|
||||
self.__bord_pos = 'default'
|
||||
self.__bord_att = []
|
||||
|
@ -1,6 +1,7 @@
|
||||
import os, tempfile, sys
|
||||
import os, sys
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy, check_encoding
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
public_dtd = 'rtf2xml1.0.dtd'
|
||||
|
||||
@ -38,7 +39,7 @@ class ConvertToTags:
|
||||
self.__encoding = 'mac_roman'
|
||||
self.__indent = indent
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__convert_utf = False
|
||||
|
||||
def __initiate_values(self):
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class DeleteInfo:
|
||||
"""Delete unecessary destination groups"""
|
||||
@ -25,7 +26,7 @@ class DeleteInfo:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
self.__initiate_allow()
|
||||
self.__bracket_count= 0
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import field_strings, copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class FieldsLarge:
|
||||
"""
|
||||
=========================
|
||||
@ -99,7 +101,7 @@ Examples
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Initiate all values.
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
|
||||
from calibre.ebooks.rtf2xml import field_strings, copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class FieldsSmall:
|
||||
"""
|
||||
@ -50,7 +51,7 @@ file.
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
|
||||
def __initiate_values(self):
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Fonts:
|
||||
"""
|
||||
@ -40,7 +41,7 @@ class Fonts:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__default_font_num = default_font_num
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
|
||||
def __initiate_values(self):
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Footnote:
|
||||
"""
|
||||
@ -30,7 +31,7 @@ class Footnote:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__found_a_footnote = 0
|
||||
|
||||
def __first_line_func(self, line):
|
||||
@ -114,7 +115,7 @@ class Footnote:
|
||||
bottom of the main file.
|
||||
"""
|
||||
self.__initiate_sep_values()
|
||||
self.__footnote_holder = tempfile.mktemp()
|
||||
self.__footnote_holder = better_mktemp()
|
||||
with open(self.__file) as read_obj:
|
||||
with open(self.__write_to, 'w') as self.__write_obj:
|
||||
with open(self.__footnote_holder, 'w') as self.__write_to_foot_obj:
|
||||
@ -243,7 +244,7 @@ class Footnote:
|
||||
"""
|
||||
if not self.__found_a_footnote:
|
||||
return
|
||||
self.__write_to2 = tempfile.mktemp()
|
||||
self.__write_to2 = better_mktemp()
|
||||
self.__state = 'body'
|
||||
self.__get_footnotes()
|
||||
self.__join_from_temp()
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class GroupBorders:
|
||||
"""
|
||||
Form lists.
|
||||
@ -40,7 +42,7 @@ class GroupBorders:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__wrap = wrap
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class GroupStyles:
|
||||
"""
|
||||
Form lists.
|
||||
@ -40,7 +42,7 @@ class GroupStyles:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__wrap = wrap
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Header:
|
||||
"""
|
||||
Two public methods are available. The first separates all of the headers
|
||||
@ -28,7 +30,7 @@ class Header:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__found_a_header = 0
|
||||
def __in_header_func(self, line):
|
||||
"""
|
||||
@ -110,7 +112,7 @@ class Header:
|
||||
self.__initiate_sep_values()
|
||||
read_obj = open(self.__file)
|
||||
self.__write_obj = open(self.__write_to, 'w')
|
||||
self.__header_holder = tempfile.mktemp()
|
||||
self.__header_holder = better_mktemp()
|
||||
self.__write_to_head_obj = open(self.__header_holder, 'w')
|
||||
line_to_read = 1
|
||||
while line_to_read:
|
||||
@ -246,7 +248,7 @@ class Header:
|
||||
"""
|
||||
if not self.__found_a_header:
|
||||
return
|
||||
self.__write_to2 = tempfile.mktemp()
|
||||
self.__write_to2 = better_mktemp()
|
||||
self.__state = 'body'
|
||||
self.__get_headers()
|
||||
self.__join_from_temp()
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile, re
|
||||
import os, re
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class HeadingsToSections:
|
||||
"""
|
||||
"""
|
||||
@ -34,7 +36,7 @@ class HeadingsToSections:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Required:
|
||||
|
@ -10,10 +10,11 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, cStringIO
|
||||
import sys, os, cStringIO
|
||||
|
||||
from calibre.ebooks.rtf2xml import get_char_map, copy
|
||||
from calibre.ebooks.rtf2xml.char_set import char_set
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Hex2Utf8:
|
||||
"""
|
||||
@ -73,7 +74,7 @@ class Hex2Utf8:
|
||||
self.__convert_wingdings = 0
|
||||
self.__convert_zapf = 0
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__bug_handler = bug_handler
|
||||
self.__invalid_rtf_handler = invalid_rtf_handler
|
||||
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Info:
|
||||
"""
|
||||
@ -38,7 +39,7 @@ class Info:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -1,6 +1,7 @@
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
"""
|
||||
States.
|
||||
@ -37,7 +38,7 @@ class Inline:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -10,10 +10,11 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.utils.cleantext import clean_ascii_chars
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class FixLineEndings:
|
||||
"""Fix line endings"""
|
||||
@ -28,7 +29,7 @@ class FixLineEndings:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__replace_illegals = replace_illegals
|
||||
|
||||
def fix_endings(self):
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class ListNumbers:
|
||||
"""
|
||||
RTF puts list numbers outside of the paragraph. The public method
|
||||
@ -36,7 +38,7 @@ class ListNumbers:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
initiate values for fix_list_numbers.
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile, re
|
||||
import sys, os, re
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class MakeLists:
|
||||
"""
|
||||
Form lists.
|
||||
@ -45,7 +47,7 @@ class MakeLists:
|
||||
self.__no_headings_as_list = no_headings_as_list
|
||||
self.__headings_to_sections = headings_to_sections
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__list_of_lists = list_of_lists
|
||||
self.__write_list_info = write_list_info
|
||||
def __initiate_values(self):
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy, border_parse
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class ParagraphDef:
|
||||
"""
|
||||
=================
|
||||
@ -66,7 +68,7 @@ if another paragraph_def is found, the state changes to collect_tokens.
|
||||
self.__default_font = default_font
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Initiate all values.
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Paragraphs:
|
||||
"""
|
||||
=================
|
||||
@ -57,7 +59,7 @@ section. (How about the end of a section or the end of a field-block?)
|
||||
self.__copy = copy
|
||||
self.__write_empty_para = write_empty_para
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Initiate all values.
|
||||
|
@ -10,9 +10,11 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
|
||||
class Pict:
|
||||
"""Process graphic information"""
|
||||
@ -28,7 +30,7 @@ class Pict:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__bracket_count = 0
|
||||
self.__ob_count = 0
|
||||
self.__cb_count = 0
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy, override_table, list_table
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class PreambleDiv:
|
||||
"""
|
||||
Break the preamble into divisions.
|
||||
@ -36,7 +38,7 @@ class PreambleDiv:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__no_namespace = no_namespace
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -10,9 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, re, tempfile
|
||||
import os, re
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy, check_brackets
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class ProcessTokens:
|
||||
"""
|
||||
@ -31,7 +32,7 @@ class ProcessTokens:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.initiate_token_dict()
|
||||
##self.initiate_token_actions()
|
||||
self.compile_expressions()
|
||||
|
@ -10,10 +10,11 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.utils.cleantext import clean_ascii_chars
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class ReplaceIllegals:
|
||||
"""
|
||||
@ -27,7 +28,7 @@ class ReplaceIllegals:
|
||||
self.__file = in_file
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
|
||||
def replace_illegals(self):
|
||||
"""
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Sections:
|
||||
"""
|
||||
=================
|
||||
@ -66,7 +68,7 @@ Instead, ingore all section information in a field-block.
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Initiate all values.
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy, border_parse
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Styles:
|
||||
"""
|
||||
Change lines with style numbers to actual style names.
|
||||
@ -35,7 +37,7 @@ class Styles:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
self.__run_level = run_level
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import sys, os, tempfile
|
||||
import sys, os
|
||||
from calibre.ebooks.rtf2xml import copy, border_parse
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
"""
|
||||
States.
|
||||
1. 'not_in_table'
|
||||
@ -64,7 +66,7 @@ class Table:
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
def __initiate_values(self):
|
||||
"""
|
||||
Initiate all values.
|
||||
|
@ -10,8 +10,10 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, tempfile
|
||||
import os
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
# note to self. This is the first module in which I use tempfile. A good idea?
|
||||
"""
|
||||
"""
|
||||
@ -42,7 +44,7 @@ class TableInfo:
|
||||
self.__copy = copy
|
||||
self.__table_data = table_data
|
||||
self.__run_level = run_level
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
# self.__write_to = 'table_info.data'
|
||||
def insert_info(self):
|
||||
"""
|
||||
|
@ -10,10 +10,11 @@
|
||||
# #
|
||||
# #
|
||||
#########################################################################
|
||||
import os, re, tempfile
|
||||
import os, re
|
||||
|
||||
from calibre.ebooks.rtf2xml import copy
|
||||
from calibre.utils.mreplace import MReplace
|
||||
from calibre.ptempfile import better_mktemp
|
||||
|
||||
class Tokenize:
|
||||
"""Tokenize RTF into one line per field. Each line will contain information useful for the rest of the script"""
|
||||
@ -27,7 +28,7 @@ class Tokenize:
|
||||
self.__file = in_file
|
||||
self.__bug_handler = bug_handler
|
||||
self.__copy = copy
|
||||
self.__write_to = tempfile.mktemp()
|
||||
self.__write_to = better_mktemp()
|
||||
# self.__write_to = out_file
|
||||
self.__compile_expressions()
|
||||
#variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user