| 535 | |
| 536 | """ Overridable function to get MD5 hash of remote files. """ |
| 537 | def md5(self, remote_path): |
| 538 | |
| 539 | action = self.actions.get('md5', {}) |
| 540 | payload = action.get('md5') |
| 541 | call_name = action.get('call', 'render') |
| 542 | |
| 543 | # Skip if something is missing or call function is not set |
| 544 | if not action or not payload or not call_name or not hasattr(self, call_name): |
| 545 | return |
| 546 | |
| 547 | execution_code = payload % ({ 'path' : remote_path }) |
| 548 | |
| 549 | result = getattr(self, call_name)( |
| 550 | code = execution_code, |
| 551 | ) |
| 552 | |
| 553 | # Check md5 result format |
| 554 | if re.match(r"([a-fA-F\d]{32})", result): |
| 555 | return result |
| 556 | else: |
| 557 | return None |
| 558 | |
| 559 | """ Overridable function to detect read capabilities. """ |
| 560 | def detect_read(self): |