Package lemon :: Package external :: Package gadfly :: Package scripts :: Module gfserver
[show private | hide private]
[frames | no frames]

Module lemon.external.gadfly.scripts.gfserver

gadfly server mode

script usage

 python gfserve.py port database directory password [startup]

test example

 python gfserve.py 2222 test dbtest admin gfstest

port is the port to listen to
database is the database to start up. (must exist!)
directory is the directory the database is in.
password is the administrative access password.

startup if present should be the name of a module to use
for startup.  The Startup module must contain a function

 Dict = startup(admin_policy, connection, Server_instance)

which performs any startup actions on the database needed
and returns either None or a Dictionary of

    name > policy objects

where the policy objects describe policies beyond the
admin policy.  The startup function may also
modify the admin_policy (disabling queries for example).

The arguments passed to startup are:
    admin_policy: the administrative policy
       eg you could turn queries off for admin, using admin
       only for server maintenance, or you could add prepared
       queries to the admin_policy.
    connection: the database connection
       eg you could perform some inserts before server start
       also needed to make policies.
    Server_instance
       Included for additional customization.

Create policies using
    P = gfserve.Policy(name, password, connection, queries=0)
      -- for a "secure" policy with only prepared queries allowed,
or
    P = gfserve.Policy(name, password, connection, queries=1)
      -- for a policy with full access arbitrary statement
         execution.

add a "named prepared statement" to a policy using
    P[name] = statement
for example
    P["updatenorm"] = '''
       update frequents
       set bar=?, perweek=?
       where drinker='norm'
     '''
in this case 'updatenorm' requires 2 dynamic parameters when
invoked from a client.

Script stdout lists server logging information.

Some server administration services (eg shutdown)
are implemented by the script interpretion of gfclient.py.

Function Summary
  main()
start up the server.

Function Details

main()

start up the server.

Generated by Epydoc 2.0 on Mon Nov 10 15:08:05 2003 http://epydoc.sf.net