Example #1
0
    def _parse(self, str):
        """ Parses the text data from an XML element defined by tag.
        """

        str = replace_entities(str)
        str = strip_tags(str)
        str = collapse_spaces(str)
        return str
Example #2
0
def _hitgroup_content_to_sorl_dt(hg):
    """Convert given HitGroupContent object into valid solr dictionary, that
    can be added to index using at least pysolr.Solr connection
    """
    doc = {
        'group_id': hg.group_id,
        'requester_id': hg.requester_id,
        'requester_name': hg.requester_name,
        'reward': hg.reward,
        'content': strip_tags(hg.html),
        'description': strip_tags(hg.description),
        'title': hg.title,
        'keywords': [k.strip() for k in hg.keywords.split(',')],
        'qualifications': hg.qualifications,
        'occurrence_date': hg.occurrence_date,
        'time_alloted': hg.time_alloted,
    }
    return doc
Example #3
0
def _hitgroup_content_to_sorl_dt(hg):
    """Convert given HitGroupContent object into valid solr dictionary, that
    can be added to index using at least pysolr.Solr connection
    """
    doc = {
        'group_id': hg.group_id,
        'requester_id': hg.requester_id,
        'requester_name': hg.requester_name,
        'reward': hg.reward,
        'content': strip_tags(hg.html),
        'description': strip_tags(hg.description),
        'title': hg.title,
        'keywords': [k.strip() for k in hg.keywords.split(',')],
        'qualifications': hg.qualifications,
        'occurrence_date': hg.occurrence_date,
        'time_alloted': hg.time_alloted,
    }
    return doc
Example #4
0
    def _parse(self, str):

        """ Parses the text data from an XML element defined by tag.
        """

        str = replace_entities(str)
        str = strip_tags(str)
        str = collapse_spaces(str)
        return str
Example #5
0
	def save(self, *args, **kwargs):
		from django.core.mail import EmailMultiAlternatives
		import html

		subject = 'MIT SBC Inquiry from ' + self.name
		from_email = self.email
		to_email = self.group.email
		html_body = self.message
		text_body = html.strip_tags(html_body)
		msg = EmailMultiAlternatives(subject, text_body, from_email, [to_email])
		msg.attach_alternative(html_body, "text/html")
		msg.send()
		if self.subscribe and Subscriber.objects.filter(email=self.email).count() == 0:
			Subscriber.objects.create(name=self.name,email=self.email)
		super(ContactMessage, self).save()
Example #6
0
    def save(self, *args, **kwargs):
        from django.core.mail import EmailMultiAlternatives
        import html

        subject = 'MIT SBC Inquiry from ' + self.name
        from_email = self.email
        to_email = self.group.email
        html_body = self.message
        text_body = html.strip_tags(html_body)
        msg = EmailMultiAlternatives(subject, text_body, from_email,
                                     [to_email])
        msg.attach_alternative(html_body, "text/html")
        msg.send()
        if self.subscribe and Subscriber.objects.filter(
                email=self.email).count() == 0:
            Subscriber.objects.create(name=self.name, email=self.email)
        super(ContactMessage, self).save()
Example #7
0
 def __str__(self):
     try:
         s = self._feed.encode("utf-8")
     except:
         s = self._feed.__str__()
     return strip_tags(s)
Example #8
0
 def __unicode__(self):
     return strip_tags(self._feed)
Example #9
0
 def __repr__(self):
     return strip_tags(self._feed.__repr__())
Example #10
0
 def __str__(self):
     try: 
         s = self._feed.encode("utf-8")
     except:
         s = self._feed.__str__()
     return strip_tags(s)
Example #11
0
 def __unicode__(self):
     return strip_tags(self._feed)
Example #12
0
 def __repr__(self):
     return strip_tags(self._feed.__repr__())