[Twisted-web] Fix for an issue 92 (windows binary distribution made with distutils doesn't install data files into package directories)

Andrea Arcangeli andrea at cpushare.com
Thu Mar 3 17:25:03 MST 2005


On Thu, Mar 03, 2005 at 11:51:25PM +0100, Valentino Volonghi wrote:
> The patch has been applied (with some improvements) in the caching branch.

Thanks! I'll check it.

> I'm on your side here and I would like to make a decision on this feature.

Sure.

> The cache is keyed with the interfaces' values that the cached tag uses 
> internally and a new context, that only remembers those selected 
> interfaces, is created and passed through the cached tag to render its 
> content.
> + very secure
> - hard to understand why you should always key with at least 
> IRendererFactory

Interfaces are nice in theory, but I'm not a big fan of interfaces in
practice. I find often just a slowdown without no advantages (yeah,
class namespace __dict__ remains clean, but often there is no other
advantage), so I doubt I'll like the IRendererFactory way. In my own
twisted code (not the web part) I intentionally never use interfaces to
be sure not to run into unnecessary slowdowns.

How would I implement the equivalent of this?

	def render_copyright(self, ctx, data):
		return ctx.tag[tags.cached('copyright_class-' + str(self.inside_account(ctx)),
					   lifetime = LIFETIME)[
			copyright_class()]]

self.inside_account(ctx) returns True or False, I'm just trying to
understand the details of the interface way.



More information about the Twisted-web mailing list