Download horae.subscription 1.0 Alpha 1



Antivirus information.

We did not scan horae.subscription 1.0 Alpha 1 for viruses, adware, spyware or other type of malware. For your own protection it's recommended to have an updated antivirus installed on your computer when downloading and installing programs from freesoftware0.

freesoftware0 lists downloads from various software publishers, so if you have a question regarding a particular software contact the publisher directly. The download links for horae.subscription 1.0 Alpha 1 are provided to you by freesoftware0 without any warranties, representations or gurantees of any kind, so download at your own risk.

Description

horae.subscription is a Python module that provides generic subscription functionality for the Horae resource planning system.

Usage

Objects marked with the horae.subscription.interfaces.ISubscribeable interfaces receive the functionality of being subscribed to. Which means a viewlet is displayed rendering all subscribers and a button to subscribe and unsubscribe if an adapter implementing horae.subscription.interfaces.ISubscriber and adapting the request is available.

The subscribers of an horae.subscription.interfaces.ISubscribeable may be notified by using the horae.subscription.interfaces.ISubscription adapter. First some basic implementations are required:

import grok

from horae.subscription import interfaces

class Subscriber(object):
 grok.implements(interfaces.ISubscriber)

 def __init__(self, id, name, url=None):
 self.id = id
 self.name = name
 self.url = url

 def notify(self, message, subject):
 """ Sends the message to the subscriber
 """
 print self.name + ': (' + subject + ') ' + subject

 def available(self, context):
 """ Whether this subscriber is currently available or not
 """
 return True

class Message(object):
 grok.implements(interfaces.IMessage)

 def __init__(self, subject, message):
 self._subject = subject
 self._message = message

 def subject(self):
 """ Returns the subject of the notification to be sent
 """
 return self._subject

 def message(self, html=False):
 """ Returns the notification message to be sent
 """
 return self._message

class Subscribeable(grok.Model):
 grok.implements(interfaces.ISubscribeable)

With those implementations in place some subscriptions may be made and a message may be sent to them.

First we create a subscribeable object:

>>> subscribeable = Subscribeable()

Now we create two subscribers and subscribe them to the subscribeable:

>>> subscriber1 = Subscriber('jsmith', 'John Smith')
>>> subscriber2 = Subscriber('jdoe', 'John Doe')
>>> subscription = interfaces.ISubscription(subscribeable)
>>> subscription.subscribe(subscriber1)
>>> subscription.subscribe(subscriber2)


And send out a message:

>>> message = Message('Test subject', 'Test message')
>>> sent, failed = subscription.notify(message)
John Smith: (Test subject) Test message
John Doe: (Test subject) Test message
>>> sent
2
>>> failed
0


Unsubscription is also done using the subscription adapter:

>>> subscription.unsubscribe(subscriber2.id)
>>> sent, failed = subscription.notify(message)
John Smith: (Test subject) Test message
>>> sent
1
>>> failed
0



Product's homepage

Requirements:

· Python
· horae.core
· horae.layout
· horae.ticketing
· grok

Related programsOur Recommendations

Xfdiff 4.5.0

Xfdiff project is graphic interface to the GNU diff and patch commands. With this utility, you can

Download

archipel-agent-hypervisor-geolocalization 0.5.0 Beta

archipel-agent-hypervisor-geolocalization is a Python module to make hypervisor able to locate

Download

The Fancy Pants Adventure World 3 1.2

Fancy Pants returns with a fresh adventure! Select your fanciest pants and get ready for World 3!

Download

Ubuntulooks-Obsidian 1.0

Ubuntulooks-Obsidian is black and white GTK theme based on the Ubuntulooks-Emerald 2

Download

collective.annotationbrowser 0.3

This package allows to browse zope.annotation based items. Package provides "ann_view" browser view

Download

TrBut 2.8

TrBut (Translate Button) is a Firefox extension that uses Google translate to translate websites to

Download

provy 0.5.0

provy is an easy-to-use server provisioning utility written in Python.Product's

Download

Gournal 0.5.1

Gournal is a note-taking application written for usage on Tablet-PCs (such as the Toshiba M200).

Download

Konversation 1.5.1 / 1.6 Beta 1

An Open Source and user-friendly Internet Relay Chat (IRC) client for your KDE desktop

Download

infi.wmi 0.0.1

infi.wmi is a monkeypatched fork of comptypes to support faster WMI access.Product's

Download


Thumbnail of horae.subscription 1.0 Alpha 1

Rating:

5 stars

Price: FREE

Publisher/Developer: Simon Kaeser

Release Date: Jun 16, 2012

View Program Details

Top Downloadslast week