Skip to content
Browse files

Added compatibility with Python 2.6+

__import__() no longer works with paths
  • Loading branch information...
1 parent 57fc2bd commit beddf2ef1426f4ebafd78cf67335b079b12675f2 @mludvig committed Feb 8, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −2 Sms/Config.py
  2. +2 −1 Sms/Sender.py
View
4 Sms/Config.py
@@ -10,13 +10,13 @@ class Config(object):
_instance = None
_parsed_files = []
- sms_engine = "Sms.GwGenericHttp" ## Module must contain class SmsDriver
+ sms_engine = "GwGenericHttp" ## Module must contain class SmsDriver
sms_recipients = [ ]
sms_url_pattern = ""
sms_message = ""
sms_timestamp_format = "%m/%d %H:%M"
## Example config for Clickatell:
- ## sms_engine = "Sms.GwClickatell"
+ ## sms_engine = "GwClickatell"
## sms_url_pattern = "https://api.clickatell.com/http/sendmsg?api_id=APIID&user=USERNAME&password=PASSWORD&to=%(recipient)s&text=%(message)s"
## replace APIID, USERNAME and PASSWORD with the values of your Clickatell account
View
3 Sms/Sender.py
@@ -6,7 +6,8 @@ class SmsError(Exception):
class SmsSender(object):
def __init__(self, recipients = [], **kwargs):
- driver_module = __import__(Config().sms_engine.replace(".","/"))
+ debug("Importing engine: %s" % Config().sms_engine)
+ driver_module = __import__("Sms." + Config().sms_engine, fromlist = ["Sms"])
self._driver = driver_module.SmsDriver(**kwargs)
self._recipients = recipients
self._message = ""

0 comments on commit beddf2e

Please sign in to comment.
Something went wrong with that request. Please try again.