durusmail: qp: subclassing site
subclassing site
2005-12-14
2005-12-14
2005-12-14
subclassing site
David Binger
2005-12-14
On Dec 14, 2005, at 12:13 PM, mario ruggier wrote:

>
> The publisher gets initialised in Site.get_publisher(), which is
> nicely enough isolated. However, I cannot just subclass Site and
> override this method, as the actual site instances themselves are
> instantiated in the class method Site.get_sites().

Why would you want to override Site.get_publisher()?
QP expects you to subclass Publisher, but not Site.
What would be the objective of subclassing Site?

> Incidentally, I was initially a little surprised with a class
> method, innocuously called get_site(), that actually creates an
> instance of its own type for every qp_site directory it finds.
> Maybe create_sites() would be a more indicative name.

The sites, conceptually, exist all the time in a qp application.
They are hard-wired
by the file system in the qp.sites package.  When you call get_sites
(), you are, in
my thinking, just asking for the sites that already exist.  The
creation of instances
representing the sites is (supposed to be) a trivial part of the
method behavior,
not the main idea.

> Also, but this may be only my aesthetic preference, wouldn't it be
> clearer to have this as a function instead of a class method?

Maybe so.
reply