Table of Contents

Module: gfserve Zope-2.2.1-src/lib/python/Products/ZGadflyDA/gadfly/gfserve.py

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.

Imported modules   
import gadfly
from gfsocket import reply_exception, reply_success, Packet_Reader, certify
import socket
Functions   
main
  main 
main ()

start up the server.

Classes   
Policy

security policy

Server

database server: listen for commands


Table of Contents

This document was automatically generated on Mon Sep 4 07:33:06 2000 by HappyDoc version r0_6