equal
deleted
inserted
replaced
7 certain support functions. We have to put these in here so they |
7 certain support functions. We have to put these in here so they |
8 can always be imported, and so that individual tests need to import |
8 can always be imported, and so that individual tests need to import |
9 nothing more than "reportlab.whatever..." |
9 nothing more than "reportlab.whatever..." |
10 """ |
10 """ |
11 |
11 |
12 import sys, os, string, fnmatch, copy, re |
12 import sys, os, fnmatch, copy, re |
13 from configparser import ConfigParser |
13 from configparser import ConfigParser |
14 import unittest |
14 import unittest |
15 |
15 |
16 # Helper functions. |
16 # Helper functions. |
17 def isWritable(D): |
17 def isWritable(D): |
104 'files' is a boolean; 1 and 0 means to return files or not. |
104 'files' is a boolean; 1 and 0 means to return files or not. |
105 'folders' is a boolean; 1 and 0 means to return folders or not. |
105 'folders' is a boolean; 1 and 0 means to return folders or not. |
106 """ |
106 """ |
107 |
107 |
108 join = os.path.join |
108 join = os.path.join |
109 split = string.split |
|
110 |
109 |
111 # If CVS subfolder doesn't exist return empty list. |
110 # If CVS subfolder doesn't exist return empty list. |
112 try: |
111 try: |
113 f = open(join(folder, 'CVS', 'Entries')) |
112 f = open(join(folder, 'CVS', 'Entries')) |
114 except IOError: |
113 except IOError: |
117 # Return names of files and/or folders in CVS/Entries files. |
116 # Return names of files and/or folders in CVS/Entries files. |
118 allEntries = [] |
117 allEntries = [] |
119 for line in f.readlines(): |
118 for line in f.readlines(): |
120 if folders and line[0] == 'D' \ |
119 if folders and line[0] == 'D' \ |
121 or files and line[0] != 'D': |
120 or files and line[0] != 'D': |
122 entry = split(line, '/')[1] |
121 entry = line.split('/')[1] |
123 if entry: |
122 if entry: |
124 allEntries.append(join(folder, entry)) |
123 allEntries.append(join(folder, entry)) |
125 |
124 |
126 return allEntries |
125 return allEntries |
127 |
126 |
137 |
136 |
138 value = ConfigParser.get(self, section, option) |
137 value = ConfigParser.get(self, section, option) |
139 |
138 |
140 # This seems to allow for newlines inside values |
139 # This seems to allow for newlines inside values |
141 # of the config file, but be careful!! |
140 # of the config file, but be careful!! |
142 val = string.replace(value, '\n', '') |
141 val = value.replace('\n', '') |
143 |
142 |
144 if self.pat.match(val): |
143 if self.pat.match(val): |
145 return eval(val) |
144 return eval(val) |
146 else: |
145 else: |
147 return value |
146 return value |