class NotificationService: def __init__(self): self.smsService = SmsService() self.facebookService = FacebookService() self.twitterService = TwitterService() def notifyAll(self, message): self.smsService.sendEmail(message) self.smsService.sendText(message) self.facebookService.postToWall(message) self.twitterService.tweet(message) def notifySocialServices(self, message): self.facebookService.postToWall(message) self.twitterService.tweet(message) def notifyPersonalServices(self, message): self.smsService.sendMail(message) self.smsService.sendText(message) def notifySpecificService(self, service, message): {'facebook': self.facebookService.postToWall(message), 'twitter': self.twitterService.tweet(message), 'email': self.smsService.sendMail(message), 'text': self.smsService.sendText(message), }[service]
def __init__(self): self.smsService = SmsService() self.facebookService = FacebookService() self.twitterService = TwitterService()
DATA.statuses = StatusService.getUserStatuses(DATA.profileUser) # if hasattr(DATA, 'user'): #facebook DATA.FBFriends = FacebookService.isFriends(DATA.user, DATA.profileUser) #Buzz DATA.BuzzFollowing = BuzzService.isFollowing( DATA.user, DATA.profileUser) DATA.BuzzFollowed = BuzzService.isFollowed(DATA.user, DATA.profileUser) #Twitter DATA.TwitterRelationship = TwitterService.getRelationship( DATA.user, DATA.profileUser) # if not DATA.userServices: DATA.profileUser.userServicesString = "Not connected to any of the services" else: DATA.profileUser.userServicesString = "Connected to " + ",".join( DATA.userServices) DATA.profileUser.statusCount = StatusService.getUserStatusCount( DATA.profileUser) path = os.path.join(os.path.dirname(__file__), 'html/profilePage.html') self.response.out.write(render(path, {'DATA': DATA})) def renderSearchPage(self): class temp:
getattr(DATA,serviceStr.lower()).authenticationStatus = "" else: getattr(DATA,serviceStr.lower()).authenticationStatus = "Unauthorised" DATA.statuses = StatusService.getUserStatuses(DATA.profileUser) # if hasattr(DATA,'user'): #facebook DATA.FBFriends = FacebookService.isFriends(DATA.user,DATA.profileUser) #Buzz DATA.BuzzFollowing = BuzzService.isFollowing(DATA.user,DATA.profileUser) DATA.BuzzFollowed = BuzzService.isFollowed(DATA.user,DATA.profileUser) #Twitter DATA.TwitterRelationship = TwitterService.getRelationship(DATA.user, DATA.profileUser) # if not DATA.userServices: DATA.profileUser.userServicesString = "Not connected to any of the services" else: DATA.profileUser.userServicesString = "Connected to " + ",".join(DATA.userServices) DATA.profileUser.statusCount = StatusService.getUserStatusCount(DATA.profileUser) path = os.path.join(os.path.dirname(__file__), 'html/profilePage.html') self.response.out.write(render(path, {'DATA':DATA})) def renderSearchPage(self): class temp: pass