-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Achim Domma (Procoders) wrote:

> can somebody explain me, what would be the recomended way to import
> external data into Zope? Let say I have developed a product which stores
>  his data in the ZODB. How can I fill the DB with data via a script and
> not via the Web interface?

 $ bin/zopectl help run
 run <script> [args] -- run a Python script with the Zope
                        environment set up.  The script can use
                        the name 'app' access the top-level Zope
                        object

So write your script such that it starts from the 'app' object,
and adds objects wherever you like;  then run the script under
zopectl.  Don't forget to add a 'commit' at the bottom, e.g.:

  try:
      from transaction import commit
  except ImportError:  # Zope < 2.8
      def commit():  get_transaction().commit()


Tres.
- --
===============================================================
Tres Seaver                                [EMAIL PROTECTED]
Zope Corporation      "Zope Dealers"       http://www.zope.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCd+SVGqWXf00rNCgRAgEsAKCJgHcFSWGjpyBo1NzwOJKyS1fagACfT6Nz
4Z/Ib/G6cGh+U1vhEGVDhzQ=
=rfHh
-----END PGP SIGNATURE-----

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to