##// END OF EJS Templates
improved behavior of FileLinks.__repr__ to be more like the behvior of _repr_html_
Greg Caporaso -
Show More
@@ -4,7 +4,7 b' Authors : MinRK, gregcaporaso'
4 """
4 """
5
5
6 from os import walk
6 from os import walk
7 from os.path import exists, isfile, splitext, abspath
7 from os.path import exists, isfile, splitext, abspath, join
8
8
9
9
10 class YouTubeVideo(object):
10 class YouTubeVideo(object):
@@ -91,7 +91,7 b' class FileLink(object):'
91 return self._format_path()
91 return self._format_path()
92
92
93 def __repr__(self):
93 def __repr__(self):
94 """return path to file
94 """return absolute path to file
95 """
95 """
96 return abspath(self.path)
96 return abspath(self.path)
97
97
@@ -149,3 +149,17 b' class FileLinks(FileLink):'
149 self.html_link_str % (fp,fn),
149 self.html_link_str % (fp,fn),
150 self.result_html_suffix]))
150 self.result_html_suffix]))
151 return '\n'.join(result_entries)
151 return '\n'.join(result_entries)
152
153 def __repr__(self):
154 """return newline-separated absolute paths
155 """
156 result_entries = []
157 for root, dirs, files in walk(self.path):
158 for fn in files:
159 fp = abspath(join(root,fn))
160 # if all files are being included, or fp has a suffix
161 # that is in included_suffix, create a link to fp
162 if self.included_suffixes == None or \
163 splitext(fn)[1] in self.included_suffixes:
164 result_entries.append(fp)
165 return '\n'.join(result_entries) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now