| 643 | |
| 644 | |
| 645 | def evaluate(self, code, **kwargs): |
| 646 | |
| 647 | prefix = kwargs.get('prefix', self.get('prefix', '')) |
| 648 | suffix = kwargs.get('suffix', self.get('suffix', '')) |
| 649 | blind = kwargs.get('blind', False) |
| 650 | |
| 651 | action = self.actions.get('evaluate', {}) |
| 652 | payload = action.get('evaluate') |
| 653 | call_name = action.get('call', 'render') |
| 654 | |
| 655 | # Skip if something is missing or call function is not set |
| 656 | if not action or not payload or not call_name or not hasattr(self, call_name): |
| 657 | return |
| 658 | |
| 659 | if '%(code_b64)s' in payload: |
| 660 | log.debug('[b64 encoding] %s' % code) |
| 661 | execution_code = payload % ({ 'code_b64' : base64.urlsafe_b64encode(code) }) |
| 662 | else: |
| 663 | execution_code = payload % ({ 'code' : code }) |
| 664 | |
| 665 | return getattr(self, call_name)( |
| 666 | code = execution_code, |
| 667 | prefix = prefix, |
| 668 | suffix = suffix, |
| 669 | blind = blind |
| 670 | ) |
| 671 | |
| 672 | def execute(self, code, **kwargs): |
| 673 | |