MCPcopy
hub / github.com/Pylons/pyramid / clone

Method clone

src/pyramid/testing.py:215–230  ·  view source on GitHub ↗

Create a clone of the resource object. If ``__name__`` or ``__parent__`` arguments are passed, use these values to override the existing ``__name__`` or ``__parent__`` of the resource. If any extra keyword args are passed in via the ``kw`` argument, use these keywor

(self, __name__=_marker, __parent__=_marker, **kw)

Source from the content-addressed store, hash-verified

213 return name in self.subs
214
215 def clone(self, __name__=_marker, __parent__=_marker, **kw):
216 """Create a clone of the resource object. If ``__name__`` or
217 ``__parent__`` arguments are passed, use these values to
218 override the existing ``__name__`` or ``__parent__`` of the
219 resource. If any extra keyword args are passed in via the ``kw``
220 argument, use these keywords to add to or override existing
221 resource keywords (attributes)."""
222 oldkw = self.kw.copy()
223 oldkw.update(kw)
224 inst = self.__class__(self.__name__, self.__parent__, **oldkw)
225 inst.subs = copy.deepcopy(self.subs)
226 if __name__ is not _marker:
227 inst.__name__ = __name__
228 if __parent__ is not _marker:
229 inst.__parent__ = __parent__
230 return inst
231
232
233DummyModel = DummyResource # b/w compat (forever)

Callers 1

rendered_viewFunction · 0.45

Calls 2

updateMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected