# -*- coding: UTF-8 -*- # Copyright (C) 2008 David Versmisse <*****@*****.**> # Copyright (C) 2009 J. David Ibáñez <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from relaxng import RelaxNGFile __all__ = [ 'RelaxNGFile', ] # Register type add_type('text/x-rng', '.rng')
# Copyright (C) 2008 Juan David Ibáñez Palomar <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from handlers import SetupConf from metadata import PKGINFOFile from packages import packages_infos from utils import get_compile_flags, get_files, get_manifest, make_version from utils import setup, get_config, OptionalExtension __all__ = [ 'get_compile_flags', 'get_config', 'get_files', 'get_manifest', 'make_version', 'packages_infos', 'OptionalExtension', 'PKGINFOFile', 'setup', 'SetupConf' ] add_type('text/x-egg-info', '.egg-info')
# -*- coding: UTF-8 -*- # Copyright (C) 2005-2007 Juan David Ibáñez Palomar <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type, get_abspath from tmx import TMXFile, Sentence, TMXUnit, TMXNote from itools.xml import register_dtd __all__ = ['TMXFile', 'Sentence', 'TMXUnit', 'TMXNote'] add_type('application/x-tmx', '.tmx') # Register DTD register_dtd(get_abspath('tmx14.dtd'), uri='http://www.lisa.org/tmx/tmx14.dtd')
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type, get_abspath from itools.xml import register_dtd from xliff import XLFFile, XLFUnit, XLFNote, File __all__ = ['XLFFile', 'XLFUnit', 'XLFNote', 'File'] # Register mime type add_type('application/x-xliff', '.xlf') # Register DTD # -//XLIFF//DTD XLIFF//EN register_dtd(get_abspath('xliff.dtd'), urn='urn:publicid:-:XLIFF:DTD+XLIFF:EN')
else: value = Property(value) # Case 4: Simple cls = self.database.get_resource_class(self.format) field = cls.get_field(name) if field is None or field.multiple is False: properties[name] = value return # Case 5: Multiple (append) if not field.datatype.is_empty(value.value): properties.setdefault(name, []).append(value) def set_property(self, name, value): self.set_changed() self._set_property(name, value) def del_property(self, name): if name in self.properties: self.set_changed() del self.properties[name] ########################################################################### # Register ########################################################################### register_handler_class(Metadata) for mimetype in Metadata.class_mimetypes: add_type(mimetype, '.%s' % Metadata.class_extension)
from itools.core import add_type from itools.handlers import register_handler_class from odf import OOFile class SXWFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.writer'] class_extension = 'sxw' class SXCFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.calc'] class_extension = 'sxc' class SXIFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.impress'] class_extension = 'sxi' # Register add_type('application/vnd.sun.xml.writer', '.sxw') add_type('application/vnd.sun.xml.calc', '.sxc') add_type('application/vnd.sun.xml.impress', '.sxi') for handler in [SXWFile, SXCFile, SXIFile]: register_handler_class(handler)
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from srx import SRXFile from segment import Message, get_segments, translate_message from segment import TEXT, START_FORMAT, END_FORMAT __all__ = [ 'SRXFile', 'TEXT', 'START_FORMAT', 'END_FORMAT', 'Message', 'get_segments', 'translate_message', ] # Register type add_type('text/x-srx', '.srx')
# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from srx import SRXFile from segment import Message, get_segments, translate_message from segment import TEXT, START_FORMAT, END_FORMAT __all__ = [ 'SRXFile', 'TEXT', 'START_FORMAT', 'END_FORMAT', 'Message', 'get_segments', 'translate_message', ] # Register type add_type('text/x-srx', '.srx')
print err % filename return zip_data(self.data, modified_files) class ODTFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.text'] class_extension = 'odt' namespace = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' class ODSFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.spreadsheet'] class_extension = 'ods' namespace = 'urn:oasis:names:tc:opendocument:xmlns:spreadsheet:1.0' class ODPFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.presentation'] class_extension = 'odp' namespace = 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0' # Register handler and mimetypes for handler in [ODTFile, ODSFile, ODPFile]: add_type(handler.class_mimetypes[0], '.%s' % handler.class_extension) register_handler_class(handler)
# -*- coding: UTF-8 -*- # Copyright (C) 2006-2008 Juan David Ibáñez Palomar <*****@*****.**> # Copyright (C) 2007 Hervé Cauwelier <*****@*****.**> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from rss import RSSFile __all__ = ['RSSFile'] add_type('application/rss+xml', '.rss')
'HTMLParser', # Filters 'sanitize_stream', 'sanitize_str', # Other functions 'stream_is_empty', 'stream_to_str_as_html', 'stream_to_str_as_xhtml', # Constants 'xhtml_uri', 'xhtml_doctype', ] # Register type add_type('application/xhtml+xml', '.xhtml') # Register DTD # -//W3C//DTD XHTML 1.0 Strict//EN register_dtd(get_abspath('xhtml1-strict.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Strict:EN') #-//W3C//DTD XHTML 1.0 Transitional//EN register_dtd(get_abspath('xhtml1-transitional.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Transitional:EN') # -//W3C//DTD XHTML 1.0 Frameset//EN register_dtd(get_abspath('xhtml1-frameset.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Frameset:EN') # -//W3C//ENTITIES Latin 1 for XHTML//EN
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # Import from the Standard Library from textwrap import wrap, fill # Import from itools from itools.core import add_type from itools.handlers import register_handler_class, ro_database, TextFile from itools.stl import stl add_type('text/x-task-tracker', '.tt') class Task(object): def __init__(self, title, description, state='open'): self.title = title self.description = description self.state = state class TaskTracker(TextFile): class_mimetypes = ['text/x-task-tracker'] ######################################################################### # Load & Save
columns.append((name, title)) return columns # Views edit = File_Edit() view = CSV_View() add_row = CSV_AddRow() edit_row = CSV_EditRow() ########################################################################### # Register ########################################################################### for js_mime in ['application/x-javascript', 'text/javascript', 'application/javascript']: Database.register_resource_class(JS, js_mime) add_type(js_mime, '.js') for csv_mime in ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/csv', 'text/csv']: Database.register_resource_class(CSV, csv_mime) add_type(csv_mime, '.csv') Database.register_resource_class(XML, 'application/xml')
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from handlers import SetupConf from metadata import PKGINFOFile from packages import packages_infos from utils import get_compile_flags, get_files, get_manifest, make_version from utils import setup, get_config, OptionalExtension __all__ = [ 'get_compile_flags', 'get_config', 'get_files', 'get_manifest', 'make_version', 'packages_infos', 'OptionalExtension', 'PKGINFOFile', 'setup', 'SetupConf'] add_type('text/x-egg-info', '.egg-info')
# Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # Import from the Standard Library from textwrap import wrap, fill # Import from itools from itools.core import add_type from itools.handlers import register_handler_class, ro_database, TextFile from itools.stl import stl add_type('text/x-task-tracker', '.tt') class Task(object): def __init__(self, title, description, state='open'): self.title = title self.description = description self.state = state class TaskTracker(TextFile): class_mimetypes = ['text/x-task-tracker']
from odf import OOFile class SXWFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.writer'] class_extension = 'sxw' class SXCFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.calc'] class_extension = 'sxc' class SXIFile(OOFile): class_mimetypes = ['application/vnd.sun.xml.impress'] class_extension = 'sxi' # Register add_type('application/vnd.sun.xml.writer', '.sxw') add_type('application/vnd.sun.xml.calc', '.sxc') add_type('application/vnd.sun.xml.impress', '.sxi') for handler in [SXWFile, SXCFile, SXIFile]: register_handler_class(handler)
for name in handler.columns: datatype = handler.schema[name] title = getattr(datatype, 'title', None) if title is None: title = name else: title = title.gettext() columns.append((name, title)) return columns # Views edit = File_Edit view = CSV_View add_row = CSV_AddRow edit_row = CSV_EditRow ########################################################################### # Register ########################################################################### for js_mime in [ 'application/x-javascript', 'text/javascript', 'application/javascript' ]: Database.register_resource_class(JS, js_mime) add_type(js_mime, '.js') Database.register_resource_class(XML, 'application/xml') Database.register_resource_class(CSV, 'text/x-comma-separated-values') Database.register_resource_class(CSV, 'text/csv')
# along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type, get_abspath from domains import register_domain, get_domain, MSG, get_language_msg from mo import MOFile from po import POFile, POUnit, encode_source __all__ = [ 'encode_source', 'register_domain', 'get_domain', 'MSG', 'MOFile', 'POFile', 'POUnit', # Utility functions 'get_language_msg', ] add_type('text/x-gettext-translation', '.po') add_type('text/x-gettext-translation-template', '.pot') add_type('application/x-gettext-translation', '.mo') add_type('application/x-gettext-translation', '.gmo') # Register the itools domain path = get_abspath('../locale') register_domain('itools', path)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type, get_abspath from domains import register_domain, get_domain, MSG from mo import MOFile from po import POFile, POUnit, encode_source __all__ = [ 'encode_source', 'register_domain', 'get_domain', 'MSG', 'MOFile', 'POFile', 'POUnit', ] add_type('text/x-gettext-translation', '.po') add_type('text/x-gettext-translation-template', '.pot') add_type('application/x-gettext-translation', '.mo') add_type('application/x-gettext-translation', '.gmo') # Register the itools domain path = get_abspath('../locale') register_domain('itools', path)
# Import from itools from itools.core import add_type from csv_ import CSVFile, Row from parser import parse from table import Table, Record, UniqueError from table import parse_table, fold_line, escape_data, is_multilingual from table import Property, property_to_str, deserialize_parameters __all__ = [ # Functions "parse", # Classes "CSVFile", "Row", # The Table handler (a kind of CSV on steroids) "Table", "Record", "Property", "property_to_str", "UniqueError", "parse_table", "fold_line", "escape_data", "is_multilingual", "deserialize_parameters", ] add_type("text/comma-separated-values", ".csv")
class ODTFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.text'] class_extension = 'odt' namespace = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' class ODSFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.spreadsheet'] class_extension = 'ods' namespace = 'urn:oasis:names:tc:opendocument:xmlns:spreadsheet:1.0' class ODPFile(ODFFile): class_mimetypes = ['application/vnd.oasis.opendocument.presentation'] class_extension = 'odp' namespace = 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0' # Register handler and mimetypes for handler in [ODTFile, ODSFile, ODPFile]: add_type(handler.class_mimetypes[0], '.%s' % handler.class_extension) register_handler_class(handler)
# Case 4: Simple cls = self.database.get_resource_class(self.format) field = cls.get_field(name) if field is None or field.multiple is False: properties[name] = value return # Case 5: Multiple (append) if not field.datatype.is_empty(value.value): properties.setdefault(name, []).append(value) def set_property(self, name, value): self.set_changed() self._set_property(name, value) def del_property(self, name): if name in self.properties: self.set_changed() del self.properties[name] ########################################################################### # Register ########################################################################### register_handler_class(Metadata) for mimetype in Metadata.class_mimetypes: add_type(mimetype, '.%s' % Metadata.class_extension)
datatype = handler.schema[name] title = getattr(datatype, 'title', None) if title is None: title = name else: title = title.gettext() columns.append((name, title)) return columns # Views edit = File_Edit view = CSV_View add_row = CSV_AddRow edit_row = CSV_EditRow ########################################################################### # Register ########################################################################### for js_mime in ['application/x-javascript', 'text/javascript', 'application/javascript']: Database.register_resource_class(JS, js_mime) add_type(js_mime, '.js') Database.register_resource_class(XML, 'application/xml') Database.register_resource_class(CSV, 'text/x-comma-separated-values') Database.register_resource_class(CSV, 'text/csv')
else: title = title.gettext() columns.append((name, title)) return columns # Views edit = File_Edit() view = CSV_View() add_row = CSV_AddRow() edit_row = CSV_EditRow() ########################################################################### # Register ########################################################################### for js_mime in [ 'application/x-javascript', 'text/javascript', 'application/javascript' ]: Database.register_resource_class(JS, js_mime) add_type(js_mime, '.js') for csv_mime in [ 'text/x-comma-separated-values', 'text/comma-separated-values', 'application/csv', 'text/csv' ]: Database.register_resource_class(CSV, csv_mime) add_type(csv_mime, '.csv') Database.register_resource_class(XML, 'application/xml')
# Parsers 'HTMLParser', # Filters 'sanitize_stream', 'sanitize_str', # Other functions 'stream_to_str_as_html', 'stream_to_str_as_xhtml', # Constants 'xhtml_uri', 'xhtml_doctype', ] # Register type add_type('application/xhtml+xml', '.xhtml') # Register DTD # -//W3C//DTD XHTML 1.0 Strict//EN register_dtd(get_abspath('xhtml1-strict.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Strict:EN') #-//W3C//DTD XHTML 1.0 Transitional//EN register_dtd(get_abspath('xhtml1-transitional.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Transitional:EN') # -//W3C//DTD XHTML 1.0 Frameset//EN register_dtd(get_abspath('xhtml1-frameset.dtd'), urn='urn:publicid:-:W3C:DTD+XHTML+1.0+Frameset:EN') # -//W3C//ENTITIES Latin 1 for XHTML//EN
# along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from itools from itools.core import add_type from csv_ import CSVFile, Row from parser import parse from table import Table, Record, UniqueError from table import parse_table, fold_line, escape_data, is_multilingual from table import Property, property_to_str, deserialize_parameters __all__ = [ # Functions 'parse', # Classes 'CSVFile', 'Row', # The Table handler (a kind of CSV on steroids) 'Table', 'Record', 'Property', 'property_to_str', 'UniqueError', 'parse_table', 'fold_line', 'escape_data', 'is_multilingual', 'deserialize_parameters', ] add_type('text/comma-separated-values', '.csv')
from itools.core import add_type from csv_ import CSVFile, Row from parser import parse from table import Table, Record, UniqueError from table import parse_table, fold_line, escape_data, is_multilingual from table import Property, property_to_str, deserialize_parameters __all__ = [ # Functions 'parse', # Classes 'CSVFile', 'Row', # The Table handler (a kind of CSV on steroids) 'Table', 'Record', 'Property', 'property_to_str', 'UniqueError', 'parse_table', 'fold_line', 'escape_data', 'is_multilingual', 'deserialize_parameters', ] add_type('text/comma-separated-values', '.csv')