Parameters ---------- path : str path to the file or directory that should be formatted url_prefix : str prefix to be prepended to all files to form a working link [default: ''] result_html_prefix : str text to
(self,
path,
url_prefix='',
result_html_prefix='',
result_html_suffix='<br>')
| 361 | html_link_str = "<a href='%s' target='_blank'>%s</a>" |
| 362 | |
| 363 | def __init__(self, |
| 364 | path, |
| 365 | url_prefix='', |
| 366 | result_html_prefix='', |
| 367 | result_html_suffix='<br>'): |
| 368 | """ |
| 369 | Parameters |
| 370 | ---------- |
| 371 | path : str |
| 372 | path to the file or directory that should be formatted |
| 373 | url_prefix : str |
| 374 | prefix to be prepended to all files to form a working link [default: |
| 375 | ''] |
| 376 | result_html_prefix : str |
| 377 | text to append to beginning to link [default: ''] |
| 378 | result_html_suffix : str |
| 379 | text to append at the end of link [default: '<br>'] |
| 380 | """ |
| 381 | if isdir(path): |
| 382 | raise ValueError("Cannot display a directory using FileLink. " |
| 383 | "Use FileLinks to display '%s'." % path) |
| 384 | self.path = fsdecode(path) |
| 385 | self.url_prefix = url_prefix |
| 386 | self.result_html_prefix = result_html_prefix |
| 387 | self.result_html_suffix = result_html_suffix |
| 388 | |
| 389 | def _format_path(self): |
| 390 | fp = ''.join([self.url_prefix, html_escape(self.path)]) |
nothing calls this directly
no outgoing calls
no test coverage detected