##// END OF EJS Templates
removed leading underscore from parameters based on suggestion from @takluyver. the initial thought was that these would be private, but there's no harm in having them be public.
Greg Caporaso -
Show More
@@ -57,8 +57,8 b' class FileLink(object):'
57 def __init__(self,
57 def __init__(self,
58 path,
58 path,
59 url_prefix='files',
59 url_prefix='files',
60 _result_html_prefix='',
60 result_html_prefix='',
61 _result_html_suffix='<br>'):
61 result_html_suffix='<br>'):
62 """
62 """
63 path : path to the file or directory that should be formatted
63 path : path to the file or directory that should be formatted
64 directory_prefix : prefix to be prepended to all files to form a
64 directory_prefix : prefix to be prepended to all files to form a
@@ -70,14 +70,14 b' class FileLink(object):'
70 """
70 """
71 self.path = path
71 self.path = path
72 self.url_prefix = url_prefix
72 self.url_prefix = url_prefix
73 self._result_html_prefix = _result_html_prefix
73 self.result_html_prefix = result_html_prefix
74 self._result_html_suffix = _result_html_suffix
74 self.result_html_suffix = result_html_suffix
75
75
76 def _format_path(self):
76 def _format_path(self):
77 fp = join(self.url_prefix,self.path)
77 fp = join(self.url_prefix,self.path)
78 return ''.join([self._result_html_prefix,
78 return ''.join([self.result_html_prefix,
79 self.link_str % (fp, self.path),
79 self.link_str % (fp, self.path),
80 self._result_html_suffix])
80 self.result_html_suffix])
81
81
82 def _repr_html_(self):
82 def _repr_html_(self):
83 """return link to local file
83 """return link to local file
@@ -114,9 +114,9 b' class FileLinks(FileLink):'
114 def __init__(self,
114 def __init__(self,
115 path,
115 path,
116 url_prefix='files',
116 url_prefix='files',
117 _included_suffixes=None,
117 included_suffixes=None,
118 _result_html_prefix='',
118 result_html_prefix='',
119 _result_html_suffix='<br>'):
119 result_html_suffix='<br>'):
120 """
120 """
121 included_suffixes : list of filename suffixes to include when
121 included_suffixes : list of filename suffixes to include when
122 formatting output [default: include all files]
122 formatting output [default: include all files]
@@ -124,12 +124,12 b' class FileLinks(FileLink):'
124 See the FileLink (baseclass of LocalDirectory) docstring for
124 See the FileLink (baseclass of LocalDirectory) docstring for
125 information on additional parameters.
125 information on additional parameters.
126 """
126 """
127 self._included_suffixes = _included_suffixes
127 self.included_suffixes = included_suffixes
128 FileLink.__init__(self,
128 FileLink.__init__(self,
129 path,
129 path,
130 url_prefix,
130 url_prefix,
131 _result_html_prefix,
131 result_html_prefix,
132 _result_html_suffix)
132 result_html_suffix)
133
133
134 def _format_path(self):
134 def _format_path(self):
135 result_entries = []
135 result_entries = []
@@ -138,9 +138,9 b' class FileLinks(FileLink):'
138 fp = join(self.url_prefix,root,fn)
138 fp = join(self.url_prefix,root,fn)
139 # if all files are being included, or fp has a suffix
139 # if all files are being included, or fp has a suffix
140 # that is in included_suffix, create a link to fp
140 # that is in included_suffix, create a link to fp
141 if self._included_suffixes == None or \
141 if self.included_suffixes == None or \
142 splitext(fn)[1] in self._included_suffixes:
142 splitext(fn)[1] in self.included_suffixes:
143 result_entries.append(''.join([self._result_html_prefix,
143 result_entries.append(''.join([self.result_html_prefix,
144 self.link_str % (fp,fn),
144 self.link_str % (fp,fn),
145 self._result_html_suffix]))
145 self.result_html_suffix]))
146 return '\n'.join(result_entries)
146 return '\n'.join(result_entries)
General Comments 0
You need to be logged in to leave comments. Login now