Esempio n. 1
0
    def exports(self):

        ExportDefinition = namedtuple(
            'ExportDefinition', ('url', 'title', 'description')
        )

        exports = []
        for provider in self.providers:

            url = provider.url or ''.join(
                (self.url(), '?export-id=', provider.id)
            )

            exports.append(
                ExportDefinition(
                    url=url,
                    title=utils.translate(
                        self.context, self.request, provider.title
                    ),
                    description=utils.translate(
                        self.context, self.request, provider.description
                    )
                )
            )

        return exports
Esempio n. 2
0
    def custom_label_widgets(self):
        """Goes throught he custom labels and applies them. """

        for field, label in self.custom_labels.items():
            if field in self.form.widgets:
                self.form.widgets[field].label = utils.translate(
                    self.context, self.request, label
                )
Esempio n. 3
0
    def exports(self):

        ExportDefinition = namedtuple('ExportDefinition',
                                      ('url', 'title', 'description'))

        exports = []
        for provider in self.providers:

            url = provider.url or ''.join(
                (self.url(), '?export-id=', provider.id))

            exports.append(
                ExportDefinition(
                    url=url,
                    title=utils.translate(self.context, self.request,
                                          provider.title),
                    description=utils.translate(self.context, self.request,
                                                provider.description)))

        return exports
Esempio n. 4
0
 def title(field):
     return utils.translate(self.context, self.request, IRoadworksDirectoryItem[field].title)