def sendMail(context, parent=None, run=True, transactional=True): """Sends out an email using context to supply the needed information. Args: context: The context supplied to the email message (dictionary) parent: The parent entity to use for when this mail is to be sent in a transaction. run: If true the mail will be sent otherwise the function that can sent the mail will be returned. transactional: Whether the task should be created transactionally. Raises: Error that corresponds with the first problem it finds iff the message is not properly initialized. List of all possible errors: http://code.google.com/appengine/docs/mail/exceptions.html """ # construct the EmailMessage from the given context message = mail.EmailMessage(**context) message.check_initialized() # don't send out emails in non-local debug mode if not system.isLocal() and system.isDebug(): return txn = mailer.getSpawnMailTaskTxn( context=context, parent=parent, transactional=transactional) if run: return db.RunInTransaction(txn) else: return txn
def sendMail(context, parent=None, run=True, transactional=True): """Sends out an email using context to supply the needed information. Args: context: The context supplied to the email message (dictionary) parent: The parent entity to use for when this mail is to be sent in a transaction. run: If true the mail will be sent otherwise the function that can sent the mail will be returned. transactional: Whether the task should be created transactionally. Raises: Error that corresponds with the first problem it finds iff the message is not properly initialized. List of all possible errors: http://code.google.com/appengine/docs/mail/exceptions.html """ # construct the EmailMessage from the given context message = mail.EmailMessage(**context) message.check_initialized() # don't send out emails in non-local debug mode if not system.isLocal() and system.isDebug(): return txn = mailer.getSpawnMailTaskTxn(context=context, parent=parent, transactional=transactional) if run: return db.RunInTransaction(txn) else: return txn
def testIsDebug(self): """Tests if Melange is running in debug mode.""" self.assertTrue(system.isDebug()) try: os.environ['CURRENT_VERSION_ID'] = 'devvin.testing-version' self.assertTrue(system.isDebug()) finally: if self.default_current_version_id is None: del os.environ['CURRENT_VERSION_ID'] else: os.environ['CURRENT_VERSION_ID'] = self.default_current_version_id try: os.environ['CURRENT_VERSION_ID'] = 'nondevvin.testing-version' self.assertTrue(system.isDebug()) finally: if self.default_current_version_id is None: del os.environ['CURRENT_VERSION_ID'] else: os.environ['CURRENT_VERSION_ID'] = self.default_current_version_id
def djangoURLPatterns(self): """Returns the URL pattern for the legacy views. """ patterns = [ ] if system.isDebug(): patterns += [ ('^seed_db$', 'soc.models.seed_db.seed'), ('^clear_db$', 'soc.models.seed_db.clear'), ('^reseed_db$', 'soc.models.seed_db.reseed'), ] return patterns
def testIsDebug(self): """Tests if Melange is running in debug mode.""" self.assertTrue(system.isDebug()) try: os.environ['CURRENT_VERSION_ID'] = 'devvin.testing-version' self.assertTrue(system.isDebug()) finally: if self.default_current_version_id is None: del os.environ['CURRENT_VERSION_ID'] else: os.environ[ 'CURRENT_VERSION_ID'] = self.default_current_version_id try: os.environ['CURRENT_VERSION_ID'] = 'nondevvin.testing-version' self.assertTrue(system.isDebug()) finally: if self.default_current_version_id is None: del os.environ['CURRENT_VERSION_ID'] else: os.environ[ 'CURRENT_VERSION_ID'] = self.default_current_version_id