suncloud Nice, France
T: 18.0°C  H: 48%  P: 1026 hPa
Wind: 3.6 m/s from North West
Few clouds
None La Tontouta Nlle-Caledonie , New Caledonia
T: 22.0°C  H: 78%  P: 1016 hPa
Wind: 2.2 m/s from North East

LibreLogiciel dot COM

Google
 
Web librelogiciel.com
Presentation
Software
Technical Support
Services
Contact
Links

 [<<< [Presentation] [ScreenShots] [News] [Download]
 

ZShellScripts :

ZShellScripts is different from ZShell

The Grand Unification Theory :

Why would Zope only support Python Scripts ?

Install ZShellScripts instead.

This will allow you to add your own languages interpreters, and even define your own language syntax. Here's how :

  1. - Create a Shell instance somewhere. Several types of Shell instances are currently provided :
    • Shell (Python) -- Can execute standard Zope Python Scripts. Code was shamelessly borrowed from Zope 2.5.1
    • Shell (Unix) -- Can execute real Unix commands as the user Zope is run as. The commands are executed at the underlying OS level.
    • Shell (Lisp) -- Can execute Lisp scripts in the PyLisp dialect.
    • Shell (Perl) -- Can execute Perl scripts as the user Zope is run as. Provides semi-transparent access to Zope objects.
    • Shell (Ruby) -- Can execute Ruby scripts as the user Zope is run as.
    • Shell (PHP) -- Can execute PHP scripts as the user Zope is run as. Semi transparent access to Zope objects is currently being worked on.
    • Shell (Zope) -- Can (will soon) execute Zope ZShell commands. This part is currently not working but be sure you'll get it soon !!!
  2. - Create a "Script (ZShell)" instance, and put the path to your Shell instance on its first line in the usual Unix shell scripts way :

    #! /path/to/myshell (this path represents a path inside the ZODB)

  3. - Put content in your ZShellScript instance, for example put Python code in it if the shell you use is an instance of "Shell (Python)", or Unix shell commands if it is an instance of "Shell (Unix)"
  4. - Run your "Script (ZShell)" instance as usual, as if it was a standard Zope Python Script for example.

    Launching your instance, will in fact delegate the code execution to the Shell instance which path you specified on the first line of your "Script (ZShell)" instance.

    The REQUEST's contents, as well as the variables usually available in native Python Scripts object, are also available transparently in your language of choice, for example, in Perl ZShellScripts you can write :

    print $context->title_or_id;

    and so on...

    Use your language facilities to learn what variables are directly accessible and their values (e.g. printenv in Unix scripts)

  5. - ???
  6. - Profit ! (ok, this one comes directly from SlashDot)
  7. - Use ShellUnix.py, ShellPython.py, ShellLisp.py or ShellZope.py as examples to create your own Shell class. ZShellScripts.py doesn't need to change.

NB : YOU DON'T NEED ZShell TO USE ZShellScripts

Enjoy !

Comments are VERY welcome.


© 2000-2014 by Jerome Alet
Email : webmaster@librelogiciel.com