コード例 #1
0
ファイル: plmapp_tags.py プロジェクト: amarh/openPLM
def plainattr(obj, attr_name):
    v = getattr(obj, attr_name)
    try:
        field = obj._meta.get_field(attr_name)
        if getattr(field, "richtext", False):
            v = plaintext(v, obj)
    except FieldDoesNotExist:
        pass
    return v
コード例 #2
0
def plainattr(obj, attr_name):
    v = getattr(obj, attr_name)
    try:
        field = obj._meta.get_field(attr_name)
        if getattr(field, "richtext", False):
            v = plaintext(v, obj)
    except FieldDoesNotExist:
        pass
    return v
コード例 #3
0
ファイル: search_indexes.py プロジェクト: pcon-world/pcon_db
 def prepare(self, object):
     self.prepared_data = QueuedSearchIndex.prepare(self, object)
     meta_fields = object._meta.get_all_field_names()
     for f in self.Meta.fields:
         if f in meta_fields and f in self.prepared_data:
             if getattr(object._meta.get_field(f), "richtext", False):
                 self.prepared_data[f] = plaintext(
                     self.prepared_data[f], object)
     return self.prepared_data
コード例 #4
0
ファイル: plmapp_tags.py プロジェクト: amarh/openPLM
def plaintext_filter(content, obj=None):
    """
    This template filter takes a string value and passes it through the
    function specified by the RICHTEXT_PLAIN_FILTER setting.
    """
    return plaintext(content, obj)
コード例 #5
0
def plaintext_filter(content, obj=None):
    """
    This template filter takes a string value and passes it through the
    function specified by the RICHTEXT_PLAIN_FILTER setting.
    """
    return plaintext(content, obj)
コード例 #6
0
ファイル: search_indexes.py プロジェクト: pcon-world/pcon_db
 def prepare_description(self, obj):
     return plaintext(obj.description, obj)
コード例 #7
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_plaintext_test(self):
     html = plaintext("TEST", self.ctrl)
     self.assertEqual(html, "test")
コード例 #8
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_plaintext_disabled(self):
     html = plaintext(SIMPLE_TEXT, self.ctrl)
     self.assertEqual(html, SIMPLE_TEXT)
     self.assertFalse(isinstance(html, SafeData))
コード例 #9
0
ファイル: filters.py プロジェクト: pcon-world/pcon_db
 def test_plaintext_default_settings(self):
     html = plaintext(SIMPLE_TEXT, self.ctrl)
     self.assertEqual(html, u"a simple text")
     self.assertFalse(isinstance(html, SafeData))