[Erp5-users] How to actually use ERP5 Catalog within CMF Portal

Jean-Paul Smets jp at nexedi.com
Fri Jul 1 12:49:45 CEST 2005


Le jeudi 30 Juin 2005 15:21, Alexey Morozov a écrit :
> I started from a freshly created CMF Portal named test. After creation
> it breaks to show because of ERP5Type/ZopePatch (known error, it's Ok,
> will fix it later).
>
> Then I deleted the standard portal_catalog tool as
> http://www.erp5.org/workspaces/project/zsqlcatalog/INSTALL.txt suggests,
> added Z MySQL DA named catalog_database_connection, and set it up to the
> previously created databased 'testcatalog'. Then I added ERP5 Catalog
> tool (it automatically got name 'portal_catalog') and inside it,
> created three ZSQL methods: z_create_catalog, z_create_roles_and_users
> and z_create_subject (w/ contents described in the mentioned INSTALL.txt)
>
> So far so good.

Sounds right. However, the INSTALL.txt is outdated. To get a correct 
configuration, please have a look at how SQL methods are configured in 
standard ERP5 installation (in the LiveCD). You need at least
	- 1 create SQL method for each table
	- 1 drop SQL method for each table
	- 1 update method for each table
	- 1 insert method for each table
	- 1 delete method for each table
	- 1 search method
	- 1 count method
	- 1 method to access table schema
and to benefit from hot reindexing, you also need
	- 1 list insert method for each table
	- 1 list update method for each table

If you have time, it would be nice to update the INSTALL.txt based on what 
you learn from the standard configuration in ERP5 LiveCD. 

> But what next?
>
> Trying to press 'Find and catalog' for DTML Documents in 'Find objects'
> leads to
> ----------------
>     * Module ZPublisher.Publish, line 101, in publish
>     * Module ZPublisher.mapply, line 88, in mapply
>     * Module ZPublisher.Publish, line 39, in call_object
>     * Module Products.ZSQLCatalog.ZSQLCatalog, line 551, in
> manage_catalogFoundItems
>
> NameError: global name 'time' is not defined (Also, an error occurred
> while attempting to render the standard error message.)
> -----------------
>

Sorry, I apparently forgot to import time. I will try o fix this.
We never use this method to catalog objects.  (because it fails with 
1,000,000 objects). I will commit fixes within 24 hours.

> Even trying to view the created portal still doesn't works because, as I
> see, the line 389 of ERP5Type/ZopePatch.py
>
>     searchres_len = int(apply(catalog.countResults, (), dict)[0][0])
>
> silently assumes that catalog.countResults will return at least one
> record... (Also it seems that python < 2.3 is a [dark] history nowadays,
> so the line above could be safely rewritten as
>
>     searchres_len = int(catalog.countResults(**dict)[0][0])
>
> assuming we catch list index errors somewhere.

Yes, countResults must return at least one record (and one only if things 
are fine).If countResults returns no record, it means the SQL method for 
countResults is not defined. You must define a method to count results.

> So what should I do next to actually start using ERP5Catalog/ZSQLCatalog?

Please try to copy what the configuration in a standard ERP5 LiveCD into 
your own CMF site. Another approach is to create an empty ERP5 site in your 
Zope instance (Add ERP5 site) and copy and paste the catalog which is 
created automaticaly. You will probably then have to tweak table 
definitions to fit your needs. This would probably the fastest approach. 

Another way is to export as a zexp a catalog from ERP5 and import it into 
your CMF site.

Once you get something up and running, you can contribute to ERP5Catalog to 
provide some SQL methods which are suitable for a standard CMF site. We 
could create a cmf_mysql or cmf_**sql if necessary.

> BTW, is there an IRC channel to ask stupid questions about ERP5 in
> real-time? :-)

Sorry, there is no IRC due to time constraints. However, if you send to me a 
Data.fs, I can try to fix up things.

JPS.

>
> Alexey Morozov
> _______________________________________________
> Erp5-users mailing list
> Erp5-users at erp5.org
> http://erp5.org/mailman/listinfo/erp5-users

-- 
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com




More information about the Erp5-users mailing list