コード例 #1
0
ファイル: ws_odf.py プロジェクト: hforge/hforge
from itools.web import BaseView, STLView, STLForm, MSG_MISSING_OR_INVALID
from itools.web import ERROR
from itools.xliff import XLFFile
from itools.xml import XMLParser, XMLError

# Import from ikaaro
from ikaaro.datatypes import FileDataType

# Import from hforge
from project import Project


# ODF i18n Testsuite location
ro_database = RODatabase(fs=lfs)
test_suite = expanduser('~/sandboxes/odf-i18n-tests/documents')
test_suite = ro_database.get_handler(test_suite)



class ODFWSDownload(BaseView):

    access = True
    query_schema = {
        'path': PathDataType}

    def GET(self, resource, context):
        path = context.query['path']
        if path is None:
            return context.come_back(MSG_MISSING_OR_INVALID)

        # Get the desired handler
コード例 #2
0
ファイル: test_handlers.py プロジェクト: staverne/itools
    def test_quote_value(self):
        # Init data
        value = "HELLO, \"WORLD\"!"
        self._init_test(value)

        # Write data
        config = ro_database.get_handler(self.config_path, ConfigFile)
        try:
            config.set_value("test", value)
        except SyntaxError, e:
            self.fail(e)
        config.save_state()

        # Read data
        config2 = ro_database.get_handler(self.config_path, ConfigFile)
        try:
            config2_value = config2.get_value("test")
        except SyntaxError, e:
            self.fail(e)
        finally:
            lfs.remove(self.config_path)

        # Test data
        self.assertEqual(config2_value, value)



    def test_wrapped_quote_value(self):
        # Init data
        value = "\"HELLO, WORLD!\""