[Twisted-Python] To twisted.web beginners: don't use RPYs
radix at twistedmatrix.com
Mon Jun 23 18:29:29 EDT 2003
On 2003.06.23 15:20, Bill Gribble wrote:
> On Wed, 2003-06-18 at 17:32, Itamar Shtull-Trauring wrote:
> > Twisted is not PHP, you can have objects persist in memory without *any
> > work*. You'd be better off never using RPYs at all, in the vast majority
> > of cases.
> You guys need to get your story straight. radix and moshez both told me
> unequivocally on IRC that as a twisted.web beginner I should
> *definitely* be using RPYs, in fact that all twisted.web development
> should be done using RPY until the app was ready to be packaged and
Well, it's like sex education. Itamar wants to go with the religious
"Tell them not to do it", I want to go with "explain to them the proper
way to do it". :-)
Lots of people are using rpys in a horrible manner; the problem is that
they're not being viewed as a deployment mechanism, but rather as the actual
"scripting" mechanism -- that rpy is Twisted's way to do web applications.
The truth is that Woven is (usually) Twisted's way to do web applications, and
rpy is Twisted's way to do deployment of web applications, be them Woven
or just plain Resource subclasses.
Thus, rpys should have as little code as possible in them -- on the order of 10
lines or less (maybe more if you decide to put very simple configuration
in them, which I have been known to do; but you should probably standardize on
a ~/.config or somesuch eventually). They should import your resource subclass
from somewhere, instantiate it (or use an already-cached one), and assign it to
the `resource' variable.
I apologise for the inconsistency.
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
More information about the Twisted-Python