def put(self): # we set the slug on the first save # after which it is never changed self.html = textile(unicode(self.description)) if not self.slug: self.slug = slugify(unicode(self.name)) super(Project, self).put()
def put(self): "Overridden save method" # we save the html here as it's faster than processing # everytime we display it self.html = textile(unicode(self.description)) # internal url is set on first save and then not changed # as the admin interface doesn't allow for changing name if not self.internal_url: slug = slugify(unicode(self.name)) self.internal_url = "/%s/%s/" % (self.project.slug, slug) # each issue has a per project unique identifier which is based # on an integer. This integer is stored in counter in the datastore # which is associated with the project if not self.identifier: counter = Counter.get_by_key_name("counter/%s" % self.project.name) if counter is None: # if it's the first issue we need to create the counter counter = Counter( key_name="counter/%s" % self.project.name, project=self.project, count=0, ) # increment the count counter.count += 1 counter.put() # save the count against the issue for use in the identifier self.identifier = counter.count # if the bug gets fixed then we store that date # if it's later marked as open we clear the date if self.fixed: self.fixed_date = datetime.now() else: self.fixed_date = None # if the bug has been fixed then send an email if self.fixed and self.email: mail.send_mail( sender="*****@*****.**", to=self.email, subject="[GitBug] Your bug has been fixed", body= """You requested to be emailed when a bug on GitBug was fixed: Issue name: %s Description: %s ------- %s ------- Thanks for using GitBug <http://gitbug.appspot.com>. A very simple issue tracker. """ % (self.name, self.description, self.fixed_description)) super(Issue, self).put()
def put(self): "Overridden save method" # we save the html here as it's faster than processing # everytime we display it self.html = textile(unicode(self.description)) # internal url is set on first save and then not changed # as the admin interface doesn't allow for changing name if not self.internal_url: slug = slugify(unicode(self.name)) self.internal_url = "/%s/%s/" % (self.project.slug, slug) # each issue has a per project unique identifier which is based # on an integer. This integer is stored in counter in the datastore # which is associated with the project if not self.identifier: counter = Counter.get_by_key_name("counter/%s" % self.project.name) if counter is None: # if it's the first issue we need to create the counter counter = Counter( key_name="counter/%s" % self.project.name, project=self.project, count=0, ) # increment the count counter.count += 1 counter.put() # save the count against the issue for use in the identifier self.identifier = counter.count # if the bug gets fixed then we store that date # if it's later marked as open we clear the date if self.fixed: self.fixed_date = datetime.now() self.priority = None else: self.fixed_date = None # if the bug has been fixed then send an email if self.fixed and self.email: mail.send_mail(sender="*****@*****.**", to=self.email, subject="[GitBug] Your bug has been fixed", body="""You requested to be emailed when a bug on GitBug was fixed: Issue name: %s Description: %s ------- %s ------- Thanks for using GitBug <http://gitbug.appspot.com>. A very simple issue tracker. """ % (self.name, self.description, self.fixed_description)) super(Issue, self).put()
def disabled_test_textile(self): tests = [ ['test', '<p>test</p>'], ['<script src="evil">evil</script>', ''], ['h1. test', '<h1>test</h1>'], ['pre. test', '<pre>test\n</pre>'], ] for input, output in tests: self.assertEqual(textile(input), output)
def disabled_test_textile(self): tests = [ ["test", "<p>test</p>"], ['<script src="evil">evil</script>', ""], ["h1. test", "<h1>test</h1>"], ["pre. test", "<pre>test\n</pre>"], ] for input, output in tests: self.assertEqual(textile(input), output)