Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, if what you want to do is send emails then use the <a href="http://docs.python.org/library/email-examples.html" rel="nofollow"><code>email</code> module</a>. </p> <p>If I were you, I would write a simple Python script which processes a bunch of rules, probably just written as simple Python statements in a separate file, then send the emails / sms / ... for those rules that require an action to be performed. </p> <p>You can make that run once a day (or whatever) using a service such as <a href="http://en.wikipedia.org/wiki/Cron" rel="nofollow">cron</a></p> <p>For example, if your rules look like this:</p> <pre><code># Rule file: rules.py def rule1(): if db.getAllUsers().contains("admin"): return ('email', 'no admin user in db') else: return None, None def rule2(): if temp &gt; 100.0: return ('sms', 'too hot in greenhouse') else: return (None, None) ... rules = [rule1, rule2, ....] </code></pre> <p>then your processing script might look like this:</p> <pre><code># Script file: engine.py import rules import email ... def send_email(message, receiver): # function that sends an email... def send_sms(message, receiver): # function that sends an sms... actions = {'email':send_email, 'sms':send_sms, ...} if __name__ == '__main__': # Declare receiver here... for rule in rules.rules: # Does the rule return a do-able action? # To be really paranoid we might wrap this in a try/finally # in case the rules themselves have any side effects, # or they don't all return 2-tuples. act, message = rule() if act in actions: # perform the action actions[rule()](message, receiver) </code></pre> <p>Undoubtedly there are other ways to do this, such as creating a <a href="http://www.ibm.com/developerworks/library/l-cpdec/index.html" rel="nofollow">Pythonic DSL</a> with which to write the rules.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload