Re: [Modeling-users] ModelMasons refactored
Status: Abandoned
Brought to you by:
sbigaret
|
From: <so...@la...> - 2003-04-20 20:43:21
|
On Sun, Apr 20, 2003 at 06:24:35PM +0200, Sebastien Bigaret wrote:
>
> > Next step on this will be to integrate the 'Base' generation-scheme,
> > as discussed earlier on the mailing-list (with a patch proposed by
> > soif).
This is from my first tests. Little things that i don't really
like :
1) As you proposed in the last discussion about this my previous patch do
something like that:
mortal
|-- Objects
| |-- Article.py
| |-- Base
| | |-- ArticleBase.py
| | |-- FolderBase.py
| | |-- FolderBase.pyc
| | |-- RssFeedBase.py
| | |-- __init__.py
| | `-- __init__.pyc
| |-- Folder.py
| |-- Folder.pyc
| |-- RssFeed.py
| |-- __init__.py
| |-- model_Mortal.py
| |-- model_Mortal.xml
| `-- setup.py
`-- __init__.py
as my package name is mortal.Objects, you can see that Base class
are cleary separated from the class you work on.
2) I look at the code i generated:
==============================================
# Modeling Base Objects
from Base.FolderBase import FolderBase
class Folder(FolderBase):
"""
Folders are objects ...
"""
def __init__(self):
"Initializer"
FolderBase.__init__(self)
===============================================
This is from the CVS version
===============================================
from FolderBase import FolderBase
from Modeling.Validation import ValidationException
from mx.DateTime import DateTimeFrom
class Folder(FolderBase):
"""
Folders are objects ...
"""
def __init__(self):
"Initializer"
# Note: if you modify this method, it is a strong requirement that
# every parameter gets a default value, since the framework needs to be
# able to instanciate an object with no parameter at all.
FolderBase.__init__(self)
===============================================
--> from Modeling.Validation import ValidationException
--> from mx.DateTime import DateTimeFrom
twiced imported (in working and in base)
the __init__(self).. have a wrong comment isnt'it ?
this isn't a big trick
>
> Ok, done. If you want to test, please update
>
> scripts/mdl_generate_python_code.py
> ModelMasons/ (whole directory)
>
>
> The old generation scheme is still the default (we can change that for 0.9),
> or with option -C (C for compact)
It should be the defaut in ZModeling too ( I haven't checkout this)
> The new one is accessible w/ the -B option (B for base)
> It generates <className>Base.py as well as <className>.py
>
> As in the 'compact' scheme, files model_<modelName>.py and .xml are
> overwritten. Additionally, '...Base' module are also overwritten.
> (TBD Note: this should be documented within the script's --help)
This sound a good feature. Anyways i don't care about anything in
Base folder w/ my patch
>
> Inheritance:
>
> The following inheritance hierarchy is generated for
> StoreEmployees.Employee/Executive:
>
> EmployeeBase <--- Employee <---- ExecutiveBase <---- Executive
>
>
> I applied the old and new schemes to StoreEmployees and AuthorBooks, with
> success (tests OK). However, here again I'll appreciate if somebody
> interested in the topic could test and double-check with his own project
> (Brad, Soif?)
Hum I don't remember how my patch handle inheritance in fact . and i
don't have a working inheritance here ...
Anyways despite my comments the generated code (from the CVS version)
works fine here.
Thanks
|