Package beepy :: Package profiles :: Module profile :: Class Profile
[show private | hide private]
[frames | no frames]

Class Profile

Known Subclasses:
BEEPManagementProfile, EchoProfile, ReverbProfile, SASLProfile, TimeProfile, TLSProfile

The profile class is the base class for all BEEP profile classes. It defines the base profile API that all profile classes need to implement.
Method Summary
  __init__(self, session, profileInit, init_callback)
Create a new Profile object.
  mimeDecode(self, payload)
mimeDecode() is a convenience function used to help make life easier for profile programmers, like me.
  mimeEncode(self, payload, contentType, encoding)
mimeEncode() is a convenience function used to help make life easier for profile programmers, like me.
  processMessage(self, msg)
processMessage() is called by the Channel to which this profile is bound.
  setChannel(self, channel)
setChannel() binds this Profile to the Channel it belongs to.

Method Details

__init__(self, session, profileInit=None, init_callback=None)
(Constructor)

Create a new Profile object.
Parameters:
session - the session to which this profile's channel belongs.
           (type=a beepy.core.session.Session object)
profileInit - initialisation data passed to the profile
           (type=bytestring)
init_callback - a method that will do further, more complex, profile initialisation at create time.
           (type=a bound method)

mimeDecode(self, payload)

mimeDecode() is a convenience function used to help make life easier for profile programmers, like me. It takes the payload and extracts the data from the headers.
Parameters:
payload - the data to decode

mimeEncode(self, payload, contentType='application/octet-stream', encoding=None)

mimeEncode() is a convenience function used to help
        make life easier for profile programmers, like me.
        It takes a given payload and adds MIME headers to it.
        Note: The separation between the MIME headers is a
        single newline '
', not '
'. Not sure why, but MimeWriter
        is doing it for some reason.

        @param payload: the data to encode
        @param contentType: the MIME content type
        @param encoding: an alternate encoding.

processMessage(self, msg)

processMessage() is called by the Channel to which this profile is bound. This forms the main processing method of a profile.

This method should be overridden by subclasses.
Parameters:
msg - the Message to process
           (type=a Message object)

setChannel(self, channel)

setChannel() binds this Profile to the Channel it belongs to. If this method is not called to set the Channel for the Profile, they channel will be unable to process any messages.

Generated by Epydoc 2.0 on Thu Sep 30 14:39:25 2004 http://epydoc.sf.net