当前位置: 首页>>代码示例>>Python>>正文


Python Document.edit方法代码示例

本文整理汇总了Python中Products.CMFDefault.Document.Document.edit方法的典型用法代码示例。如果您正苦于以下问题:Python Document.edit方法的具体用法?Python Document.edit怎么用?Python Document.edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.CMFDefault.Document.Document的用法示例。


在下文中一共展示了Document.edit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_StructuredText

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
    def test_StructuredText(self):
        d = Document('foo')
        assert hasattr(d, 'cooked_text')
        d.edit(text_format='structured-text', text=BASIC_STRUCTUREDTEXT)
        
        assert d.Format() == 'text/plain'
        assert d.Title() == 'My Document'
        assert d.Description() == 'A document by me'
        assert len(d.Contributors()) == 3
        assert string.find(d.cooked_text, '<p>') >= 0
        assert string.find(d.CookedBody(), '<h1') >= 0

        # Make sure extra HTML is NOT found
        assert string.find(d.cooked_text, '<title>') == -1, d.cooked_text
        assert string.find(d.cooked_text, '<body>') == -1, d.cooked_text

        # test subject/keyword headers
        subj = list(d.Subject())
        assert len(subj) == 4
        subj.sort()
        assert subj == [
            'content management',
            'framework',
            'unit tests',
            'zope'
            ]
开发者ID:goschtl,项目名称:zope,代码行数:28,代码来源:test_Document.py

示例2: edit

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def edit( self, text, description=None, text_format=None ):
     """Edit the News Item.
     """
     if text_format is None:
         text_format = getattr(self, 'text_format', 'structured-text')
     if description is not None:
         self.setDescription( description )
     Document.edit( self, text_format, text )
开发者ID:nacho22martin,项目名称:tesis,代码行数:10,代码来源:NewsItem.py

示例3: test_UpperedHtml

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_UpperedHtml(self):
     d = Document('foo')
     d.edit(text_format='', text=string.upper(BASIC_HTML))
     assert d.Format() == 'text/html'
     assert d.title == 'TITLE IN TAG'
     assert string.find(d.text, '</BODY') == -1
     assert d.Description() == 'DESCRIBE ME'
     assert len(d.Contributors()) == 3
开发者ID:goschtl,项目名称:zope,代码行数:10,代码来源:test_Document.py

示例4: test_StructuredText

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_StructuredText(self):
     d = Document('foo')
     d.edit(text_format='structured-text', text=BASIC_STRUCTUREDTEXT)
     
     assert d.Format() == 'text/plain'
     assert d.Title() == 'My Document'
     assert d.Description() == 'A document by me'
     assert len(d.Contributors()) == 3
     assert string.find(d.cooked_text, '<p>') >= 0
开发者ID:goschtl,项目名称:zope,代码行数:11,代码来源:test_Document.py

示例5: test_STX_NoHeaders_but_colon

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
    def test_STX_NoHeaders_but_colon( self ):
        d = Document('foo')
        d.editMetadata( title="Plain STX"
                       , description="Look, Ma, no headers!"
                       , subject=( "plain", "STX" )
                       )

        d.edit(text_format='structured-text', text=STX_NO_HEADERS_BUT_COLON)
        self.assertEqual( d.EditableBody(), STX_NO_HEADERS_BUT_COLON )
开发者ID:goschtl,项目名称:zope,代码行数:11,代码来源:test_Document.py

示例6: test_BigHtml

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_BigHtml(self):
     d = Document('foo')
     s = []
     looper = '<li> number %s</li>'
     for i in range(12000): s.append(looper % i)
     body = '<ul>\n%s\n</ul>' % string.join(s, '\n')
     html = HTML_TEMPLATE % {'title': 'big document',
                             'body': body}
     d.edit(text_format=None, text=html)
     assert d.CookedBody() == body
开发者ID:goschtl,项目名称:zope,代码行数:12,代码来源:test_Document.py

示例7: test_BigHtml_via_upload

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_BigHtml_via_upload(self):
     d = Document('foo')
     s = []
     looper = '<li> number %s</li>'
     for i in range(12000): s.append(looper % i)
     body = '<ul>\n%s\n</ul>' % string.join(s, '\n')
     html = HTML_TEMPLATE % {'title': 'big document',
                             'body': body}
     from StringIO import StringIO
     file = StringIO( html )
     d.edit(text_format='html', text='', file=file)
     self.assertEqual( d.CookedBody(), body )
开发者ID:goschtl,项目名称:zope,代码行数:14,代码来源:test_Document.py

示例8: edit

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def edit(self,   
         title='',
         position='',
         topic='',
         description='',
         source='',
         url='',
         text='',
         text_format='',
         file='',
         ):
     """ Edit article properties """     
     Document.edit(self, text_format, text, file)
     self.editMetadata(title=title, description=description)
     self.position=position
     self.topic=topic
     self.source = source
     self.url = string.split(url,'\n')
开发者ID:BackupTheBerlios,项目名称:plonenewsletter,代码行数:20,代码来源:Article.py

示例9: test_STX_NoHeaders

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
    def test_STX_NoHeaders( self ):
        d = Document('foo')
        d._editMetadata( title="Plain STX"
                       , description="Look, Ma, no headers!"
                       , subject=( "plain", "STX" )
                       )
        assert d.Format() == 'text/html'
        assert d.Title() == 'Plain STX'
        assert d.Description() == 'Look, Ma, no headers!'
        assert len( d.Subject() ) == 2
        assert 'plain' in d.Subject()
        assert 'STX' in d.Subject()

        d.edit(text_format='structured-text', text=STX_NO_HEADERS)
        
        assert d.Format() == 'text/plain'
        assert d.Title() == 'Plain STX'
        assert d.Description() == 'Look, Ma, no headers!'
        assert len( d.Subject() ) == 2
        assert 'plain' in d.Subject()
        assert 'STX' in d.Subject()
开发者ID:goschtl,项目名称:zope,代码行数:23,代码来源:test_Document.py

示例10: test_STX_Levels

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
    def test_STX_Levels(self):
        d = Document('foo')
        d.edit(text_format='structured-text', text=BASIC_STRUCTUREDTEXT)
        self.assertEqual( d._stx_level, 1 )

        ct = d.CookedBody()
        self.failUnless( string.find(d.CookedBody(), '<h1') >= 0 )
        self.assertEqual( d._stx_level, 1 )

        ct = d.CookedBody(stx_level=2)
        self.failIf( (string.find(ct, '<h1') >= 0) )
        self.failUnless( string.find(ct, '<h2') >= 0 )
        self.assertEqual( d._stx_level, 1 )

        ct = d.CookedBody(stx_level=2, setlevel=1)
        self.failIf( (string.find(ct, '<h1') >= 0) )
        self.failUnless( string.find(ct, '<h2') >= 0 )
        self.assertEqual( d._stx_level, 2 )

        ct = d.CookedBody()
        self.assertEqual( d._stx_level, 2 )
        self.failIf( (string.find(d.CookedBody(), '<h1') >= 0) )
        self.failUnless( string.find(d.CookedBody(), '<h2') >= 0 )
开发者ID:goschtl,项目名称:zope,代码行数:25,代码来源:test_Document.py

示例11: test_STX_Levels

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
    def test_STX_Levels(self):
        d = Document('foo')
        d.edit(text_format='structured-text', text=BASIC_STRUCTUREDTEXT)
        assert d._stx_level == 1

        ct = d.CookedBody()
        assert string.find(d.CookedBody(), '<h1') >= 0
        assert d._stx_level == 1

        ct = d.CookedBody(stx_level=2)
        assert not (string.find(ct, '<h1') >= 0)
        assert string.find(ct, '<h2') >= 0
        assert d._stx_level == 1

        ct = d.CookedBody(stx_level=2, setlevel=1)
        assert not (string.find(ct, '<h1') >= 0)
        assert string.find(ct, '<h2') >= 0
        assert d._stx_level == 2

        ct = d.CookedBody()
        assert d._stx_level == 2
        assert not (string.find(d.CookedBody(), '<h1') >= 0)
        assert string.find(d.CookedBody(), '<h2') >= 0
开发者ID:goschtl,项目名称:zope,代码行数:25,代码来源:test_Document.py

示例12: test_EditStructuredTextWithHTML

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_EditStructuredTextWithHTML(self):
     d = Document('foo')
     d.edit(text_format=None, text=STX_WITH_HTML)
     
     assert d.Format() == 'text/plain', "%s != %s" % (
         d.Format(), 'text/plain')
开发者ID:goschtl,项目名称:zope,代码行数:8,代码来源:test_Document.py

示例13: test_HtmlWithoutNewlines

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_HtmlWithoutNewlines(self):
     d = Document('foo')
     html = string.join(string.split(BASIC_HTML, '\n'), '')
     d.edit(text_format='', text=html)
     assert d.Format() == 'text/html'
     assert d.Description() == 'Describe me'
开发者ID:goschtl,项目名称:zope,代码行数:8,代码来源:test_Document.py

示例14: test_HtmlWithDoctype

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_HtmlWithDoctype(self):
     d = Document('foo')
     html = '%s\n%s' % (DOCTYPE, BASIC_HTML)
     d.edit(text_format='', text=html)
     assert d.Description() == 'Describe me'
开发者ID:goschtl,项目名称:zope,代码行数:7,代码来源:test_Document.py

示例15: test_EntityInTitle

# 需要导入模块: from Products.CMFDefault.Document import Document [as 别名]
# 或者: from Products.CMFDefault.Document.Document import edit [as 别名]
 def test_EntityInTitle(self):
     d = Document('foo')
     d.edit(text_format='html', text=ENTITY_IN_TITLE)
     assert d.title == '&Auuml;rger', "Title '%s' being lost" % (
         d.title )
开发者ID:goschtl,项目名称:zope,代码行数:7,代码来源:test_Document.py


注:本文中的Products.CMFDefault.Document.Document.edit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。