Re: [Modeling-users] fetching problem
Status: Abandoned
Brought to you by:
sbigaret
|
From: Sebastien B. <sbi...@us...> - 2003-03-02 14:52:46
|
> > > But I can't fetch any value, the following code :
> > >
> > > from Modeling.EditingContext import EditingContext
> > > from Modeling.FetchSpecification import FetchSpecification
> > > from Autogen.PROJECT import PROJECT
> >=20
> > I found the problem, the import statement was edited for the email,=
it
> > really was from core.utils.Autogen import PROJECT. The if I flatten
> > my hierarchy a bit to REALLY have from Autogen.PROJECT import PROJE=
CT,
> > it works perfectly.
> >=20
> > Do you plan to support sub-package import in future releases ?
>=20
> Okay, I think I see your problem: you generated the python code
> templates with the model you supplied in your previous mail, than you
> put the generated package in package core.utils.
>=20
> If true, the only thing you need to change is attribute 'packageName'=
of
> xml-entity <model>: change it from 'Autogen' to 'core.utils.Autogen',
> and you'll see that your entities can now find their own classes (you=
'll
> probably want to modify both model_Autogen.xml and model_Autogen.py)
>=20
> BTW this question is addressed in section 2.6 / FAQ of the User's
> Guide ;) but if you read it and did not understand that way, please
> tell me
>=20
> However, you did find a bug here: it shouldn't raise UnboundLocalError
> but at least something more informative! Could you please take some t=
ime
> and fill in a bug report in sourceforge's tracker?
Fixed in CVS repository.
The exception raised now looks like the following, hopefully more
informative:
Traceback (most recent call last):
File "./test_EntityClassDescription.py", line 60, in test_02_classFor=
Entity_incorrect_packageName
EntityClassDescription.classForEntity(e)
File "Modeling/EntityClassDescription.py", line 504, in classForEntity
raise ImportError, err_msg
ImportError: Unable to locate class Dummy.StoreEmployees.Employee.Emplo=
yee corresponding to entity 'Employee'.
It is possible that the model's packageName, or the entity's moduleName=
or
className do not correspond to where the module is installed --for exam=
ple,
you might have moved it to a sub-package. You can solve this easily by
updating your model so that 'packageName.moduleName.className' points to
the exact location where the class is installed
Original exception was: ImportError: No module named Dummy
-- S=E9bastien.
|