Public Member Functions | Friends

BnPython Class Reference

This is a wrapper to the Python interpreter, for the Beesnest server. More...

#include <BnPython.h>

Inheritance diagram for BnPython:
IdcEngine

List of all members.

Public Member Functions

 BnPython (const char *name, bool(*pGetParam)(const char *, char *, int))
 Constractor - Starts the interpreter and initialize variables.
virtual ~BnPython ()
 Destructor - Close the interpreter.
virtual bool Process (BufferHolder code, BufferHolder &result, int size_limit)
 Do the actual processing of a script.
virtual void Prepare (IdcRequest *preq, IdcResponse *pres, IdcAdaptersSet *pset)
 Prepare the class for a new request.
virtual bool IsStorable ()
 Just return True in most cases.
virtual void Stored ()
 Make sure all the adapters are released, and clear the buffer that goes back to Beesnest.

Friends

PyObject * Print (PyObject *self, PyObject *args)
PyObject * GetRequestHeader (PyObject *self, PyObject *args)
PyObject * GetRequestVariable (PyObject *self, PyObject *args)
PyObject * SetRequestVariable (PyObject *self, PyObject *args)
PyObject * GetRequestVarsNamesList (PyObject *self, PyObject *args)
PyObject * SetResponseHeader (PyObject *self, PyObject *args)
PyObject * SetResponseCookie (PyObject *self, PyObject *args)
PyObject * Clear (PyObject *self, PyObject *args)
PyObject * Flush (PyObject *self, PyObject *args)
PyObject * GetAdapter (PyObject *self, PyObject *args)
PyObject * ReleaseAdapter (PyObject *self, PyObject *args)
PyObject * Read (PyObject *self, PyObject *args)
PyObject * Write (PyObject *self, PyObject *args)
PyObject * Exit (PyObject *self, PyObject *args)

Detailed Description

This is a wrapper to the Python interpreter, for the Beesnest server.


The only issue here is that the Python interpreter works with "C" style functions, but Beesnest works with classes and objects. The solution: in every call to a Beesnest function from python, "self" will be an integer that will map to one of this class instances. The user doesn't have to do anything for it.

2008-01-18 - I overload the "exit" function. It will terminate the script but return True (so it will not consider as an error). However, I use Python exception to do it. Calling sys.exit terminate the entire Beesnest application. This is a bug!

Definition at line 31 of file BnPython.h.


Constructor & Destructor Documentation

BnPython::BnPython ( const char *  name,
bool(*)(const char *, char *, int)  pGetParam 
)

Constractor - Starts the interpreter and initialize variables.

It also inserts the pointer to this object (this) to the Pointers map, under a new integer key.

Definition at line 267 of file BnPython.cpp.

BnPython::~BnPython (  ) [virtual]

Destructor - Close the interpreter.

Definition at line 291 of file BnPython.cpp.


Member Function Documentation

virtual bool BnPython::IsStorable (  ) [inline, virtual]

Just return True in most cases.

Return False after an exception.

Reimplemented from IdcEngine.

Definition at line 115 of file BnPython.h.

void BnPython::Prepare ( IdcRequest preq,
IdcResponse pres,
IdcAdaptersSet pset 
) [virtual]

Prepare the class for a new request.

Set the new Request, Response and maybe Adapters Set objects.

Implements IdcEngine.

Definition at line 309 of file BnPython.cpp.

bool BnPython::Process ( BufferHolder  code,
BufferHolder result,
int  size_limit 
) [virtual]

Do the actual processing of a script.

Implements IdcEngine.

Definition at line 317 of file BnPython.cpp.

void BnPython::Stored (  ) [virtual]

Make sure all the adapters are released, and clear the buffer that goes back to Beesnest.

Reimplemented from IdcEngine.

Definition at line 302 of file BnPython.cpp.


Friends And Related Function Documentation

PyObject* Clear ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 107 of file BnPython.cpp.

PyObject* Exit ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 216 of file BnPython.cpp.

PyObject* Flush ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 116 of file BnPython.cpp.

PyObject* GetAdapter ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 136 of file BnPython.cpp.

PyObject* GetRequestHeader ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 32 of file BnPython.cpp.

PyObject* GetRequestVariable ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 43 of file BnPython.cpp.

PyObject* GetRequestVarsNamesList ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 66 of file BnPython.cpp.

PyObject* Print ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 5 of file BnPython.cpp.

PyObject* Read ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 166 of file BnPython.cpp.

PyObject* ReleaseAdapter ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 151 of file BnPython.cpp.

PyObject* SetRequestVariable ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 54 of file BnPython.cpp.

PyObject* SetResponseCookie ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 89 of file BnPython.cpp.

PyObject* SetResponseHeader ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 77 of file BnPython.cpp.

PyObject* Write ( PyObject *  self,
PyObject *  args 
) [friend]

Definition at line 190 of file BnPython.cpp.


The documentation for this class was generated from the following files: