Fixed merge for v0.2.13
This commit is contained in:
parent
f8795a4c48
commit
76d20774a5
3 changed files with 68 additions and 10 deletions
|
@ -1 +1 @@
|
||||||
__version__ = '0.2.12'
|
__version__ = '0.2.13'
|
||||||
|
|
|
@ -1647,15 +1647,6 @@ class Request(HTTPMessage):
|
||||||
retreq.set_websocket_messages([m.duplicate() for m in self.websocket_messages])
|
retreq.set_websocket_messages([m.duplicate() for m in self.websocket_messages])
|
||||||
return retreq
|
return retreq
|
||||||
|
|
||||||
def duplicate(self):
|
|
||||||
retreq = self.copy()
|
|
||||||
retreq.reqid = self.reqid
|
|
||||||
if self.unmangled:
|
|
||||||
retreq.unmangled = self.unmangled.duplicate()
|
|
||||||
if self.response:
|
|
||||||
retreq.response = self.response.duplicate()
|
|
||||||
return retreq
|
|
||||||
|
|
||||||
def duplicate(self):
|
def duplicate(self):
|
||||||
retreq = self.copy()
|
retreq = self.copy()
|
||||||
retreq.reqid = self.reqid
|
retreq.reqid = self.reqid
|
||||||
|
|
|
@ -369,6 +369,73 @@ class MacroTemplate(object):
|
||||||
def template_argstring(cls, template):
|
def template_argstring(cls, template):
|
||||||
return cls._template_data[template][2]
|
return cls._template_data[template][2]
|
||||||
|
|
||||||
|
## Other functions
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def async_mangle_ws(self, request, message):
|
||||||
|
if hasattr(self.source, 'async_mangle_ws'):
|
||||||
|
mangled_ws = yield self.source.async_mangle_ws(request, message)
|
||||||
|
defer.returnValue(mangled_ws)
|
||||||
|
defer.returnValue(message)
|
||||||
|
|
||||||
|
class MacroTemplate(object):
|
||||||
|
_template_data = {
|
||||||
|
'macro': ('macro.py.template',
|
||||||
|
'Generic macro template',
|
||||||
|
'[reqids]',
|
||||||
|
'macro_{fname}.py',
|
||||||
|
gen_template_args_macro),
|
||||||
|
|
||||||
|
'intmacro': ('intmacro.py.template',
|
||||||
|
'Generic intercepting macro template',
|
||||||
|
'',
|
||||||
|
'int_{fname}.py',
|
||||||
|
gen_template_generator_noargs('intmacro')),
|
||||||
|
|
||||||
|
'modheader': ('macro_header.py.template',
|
||||||
|
'Modify a header in the request and the response if it exists.',
|
||||||
|
'',
|
||||||
|
'int_{fname}.py',
|
||||||
|
gen_template_generator_noargs('modheader')),
|
||||||
|
|
||||||
|
'resubmit': ('macro_resubmit.py.template',
|
||||||
|
'Resubmit all in-context requests',
|
||||||
|
'',
|
||||||
|
'macro_{fname}.py',
|
||||||
|
gen_template_generator_noargs('resubmit')),
|
||||||
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def fill_template(cls, template, subs):
|
||||||
|
loader = FileSystemLoader(session.config.pappy_dir+'/templates')
|
||||||
|
env = Environment(loader=loader)
|
||||||
|
template = env.get_template(cls._template_data[template][0])
|
||||||
|
return template.render(zip=zip, **subs)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def fill_template_args(cls, template, args=[]):
|
||||||
|
ret = cls._template_data[template][4](args)
|
||||||
|
if isinstance(ret, defer.Deferred):
|
||||||
|
ret = yield ret
|
||||||
|
defer.returnValue(ret)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def template_filename(cls, template, fname):
|
||||||
|
return cls._template_data[template][3].format(fname=fname)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def template_list(cls):
|
||||||
|
return [k for k, v in cls._template_data.iteritems()]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def template_description(cls, template):
|
||||||
|
return cls._template_data[template][1]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def template_argstring(cls, template):
|
||||||
|
return cls._template_data[template][2]
|
||||||
|
|
||||||
## Other functions
|
## Other functions
|
||||||
|
|
||||||
def load_macros(loc):
|
def load_macros(loc):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue