On 8/9/2019 1:55 PM, ingo wrote:
With the available classes Root, Channel and SSE I build the following
(in CherryPy):
root = Root()
root.channel = Channel()
root.channel.weather = SSE('weather')
root.channel.energy = SSE('energy')
root.channel.mail = SSE('mail')
root.channel.rss = SSE('rss')
...
http://example.com/channel/weather/ will then become the emitter of the
weather event stream.
I'd like create the instances of SSE programmatically by pulling the
string 'weather', 'energy' etc. from a database.
Are you asking for help in obtaining a value from a database?
Or how to dynamically create instances assigned to root.channel attributes?
Assuming the latter:
name = # get from data base
setattr(root.channel, name, SSE(name))
--
Bob Gailer
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor