Hi, thanks for helping me!

I will read about the mixin too...

> > def createClass(class1, class2):
> >   class x(class1, class2):
> >     title=class2.title
> >     writeBody=lambda self, **kw: class2.writeBody(self, **kw)
> >   return x
> > ...
> 
> You can do that?  Cool.  
> 
> If you list class2 first ( class x(class2, class1) ), doesn't
> class2's
> attributes/methods automatically override class1's?  Then you
> wouldn't
> have to assign them explicitly.

This is the really problem, class1 and class2 are templates, I using
the iheritance approach with cheetah so all my pages are templates or
based on templates...

Suposse I have the follow servlets:

#-- module BaseSite --
class Model(Template):
  # this model defines a standard look-and-feel
  ...
class Main(Model):
  title='main page'
  def writeBody(self):
   ...
class Search(Model):
  title='search page'
  def writeBody(self):
    ...
  def searchMethod(self):
    ...
#----

And suppose I have another site in another module:

#-- module GreenSite --
class Model(Template):
  # this model defines a green look-and-feel
  ...
Main=createClass(Model, BaseSite.Main)
Search=createClass(Model, BaseSite.Search)
#-----

This way the Main and Search class on the GreenSite will be the same of
the BaseSite, but with green look-and-feel. For Main it's ok 'cause
Main have only title and writeBody defined (the class have all method
inherited from BaseSite.Model but I don't care about this modules).

The Search class will be a problem for me, it haves a method called
searchMethod, this method is not listed on my function, so I need to
write another function that works with searchMethod method.

Again, can I know what methods I am reimplementing on determined class?
Suppose the Search class:

#-----
class Search(Model):
  title='some specific title'
  reversedOrder=True # to know if the order will be reversed i.e.
  def writeBody(self, **kw):
    ...
  def getQuery(self):
    ...
  def searchMethod(self):
    ...
#-----

I want to have a list with [title, reversedOrder, writeBody, getQuery,
searchMethod], but only these method, not Model inherited methods,
understand? This way I can create the function that gets a model or a
template and put on it only the right methods...

thanks for all help and sorry my poor english :)

=====
--
Michel Thadeu Sabchuk
Curitiba/PR


        
        
                
_______________________________________________________
Yahoo! Acesso Gr�tis - navegue de gra�a com conex�o de qualidade! Acesse: 
http://br.acesso.yahoo.com/


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to