On 22/03/10 16:09 +0000, Sharoon Thomas wrote:
> These ideas are really good and will make Tryton more pythonic.
> 
> Regarding Model:
> 
> If metaclass programming is used and each record becomes an instance of the
> class representing the model, then the methods of the class becomes
> methods/functions/properties acting on individual instances (or records) and
> not the object as a whole.
> 
> 
>    - So how is the extension of modules planned ?

I don't understand.

> 
> 
> For example:
> 
> a current pool.get(object).write(...) can no longer exist but a write will
> be method of the instance.

This will still exist but pool.get('object') will return a class and no more
an instance.

> 
> So if productcategory1 = ProductCategory(<values>) then the write method
> will be an instance method therefore productcategory1.write(<values>)
> 
> 
>    - Can we use args/kwargs based initiation

Why not. But we should keep current dictionary values for rpc calls.

> 
> I think the metaclass programming should give us the advantage of creating
> instance objects from kwargs. For example new_category =
> ProductCategory(name="Computers", code="COMP")
> 
> 
>    - Can inheritance of models also be pythonic?
> 
> Instead of using _inherit = '' can we directly use python inheritance. For

There is no _inherit in Tryton.

> example, if we have to extend product category then:
> 
> from trytond.modules.product.category import ProductCategory
> 
> class NewProductCategory(ProductCategory):
>    def get_full_name(self):
>          return self.parent_name + "/" + self.name

This is not possible but we should try a way to improve the current
implementation.


-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgp8ViFqIrftR.pgp
Description: PGP signature

Reply via email to