__doc__ = "" import types from pyramid.i18n import get_localizer from pyramid.threadlocal import get_current_request from nive.tools import Tool from nive.helper import FakeLocalizer from nive.definitions import ToolConf, IApplication from nive.i18n import _ from nive.utils.utils import FormatBytesForDisplay configuration = ToolConf() configuration.id = "cmsstatistics" configuration.context = "nive.components.tools.cmsstatistics.cmsstatistics" configuration.name = _(u"CMS Statistics") configuration.description = _("This function provides a short summary of elements and data contained in the website.") configuration.apply = (IApplication,) configuration.data = [ ] configuration.mimetype = "text/html" class cmsstatistics(Tool): """ """
``view.RenderView(tool)`` """ tool = self.context values = self.GetFormValues(method="POST") values["request"] = self.request result = tool.Run(**values) data = tool.stream if not isinstance(data, basestring): try: data = data.getvalue() except: data = str(data) return self.SendResponse(data, mime=self.context.mimetype, raiseException=False) configuration = ToolConf() configuration.id = "dbStructureUpdater" configuration.context = "nive.components.tools.dbStructureUpdater.dbStructureUpdater" configuration.name = _(u"Database Structure") configuration.description = _(u"Generate or update the database structure based on configuration settings.") configuration.apply = (IApplication,) configuration.data = [ FieldConf(id="modify", datatype="bool", default=0, name=_(u"Modify existing columns"), description=_(u"Change existing database columns to new configuration. Depending on the changes, data may be lost!")), FieldConf(id="showSystem", datatype="bool", default=0, name=_(u"Show system columns"), description=u"") ] configuration.mimetype = "text/html" configuration.views = [ ViewConf(name="", view=dbView, attr="view", permission="system", context="nive.components.tools.dbStructureUpdater.dbStructureUpdater") ] class dbStructureUpdater(Tool):
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. All rights reserved. # Released under GPL3. See license.txt # from nive.tool import Tool, ToolView from nive.definitions import ToolConf, FieldConf, ViewConf from nive.definitions import IApplication, MetaTbl, Structure from nive.i18n import _ configuration = ToolConf( id = "dbSqlDump", context = "nive.tools.dbSqlDump.dbSqlDump", name = _(u"Database sql dump"), description = _("This function dumps table contents as SQL INSERT statements. 'CREATE table' statements are not included."), apply = (IApplication,), mimetype = "text/sql" ) configuration.data = [ FieldConf(id="excludeSystem", datatype="checkbox", default=[], listItems=[{"id":"pool_sys", "name":"pool_sys"},{"id":"pool_fulltext","name":"pool_fulltext"}], name=_(u"Exclude system columns")) ] configuration.views = [ ViewConf(name="", view=ToolView, attr="form", permission="system", context="nive.tools.dbSqlDump.dbSqlDump") ] class dbSqlDump(Tool):
# 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/>. #---------------------------------------------------------------------- __doc__ = "" import types from nive.tools import Tool from nive.definitions import ToolConf, FieldConf configuration = ToolConf() configuration.id = "exampletool" configuration.context = "nive.components.tools.example.tool" configuration.name = u"Empty tool for tests" configuration.description = "" configuration.apply = None #(IApplication,) configuration.data = [ FieldConf(**{"id": "parameter1", "datatype": "bool", "required": 0, "readonly": 0, "default": 0, "name": u"Show 1", "description": u"Display 1"}), FieldConf(**{"id": "parameter2", "datatype": "string", "required": 0, "readonly": 0, "default": 0, "name": u"Show 2", "description": u"Display 2"}) ] configuration.mimetype = "text/html" class tool(Tool):
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. All rights reserved. # Released under GPL3. See license.txt # from nive.tool import Tool, ToolView from nive.definitions import ToolConf, FieldConf, ViewConf configuration = ToolConf( id = "exampletool", context = "nive.tools.example.tool", name = u"Empty tool for tests", description = "", apply = None, #(IObject,) mimetype = "text/html", ) configuration.data = [ FieldConf(id="parameter1", datatype="bool", default=0, name=u"Show 1", description=u"Display 1"), FieldConf(id="parameter2", datatype="string", required=1, default="", name=u"Show 2", description=u"Display 2") ] configuration.views = [ ViewConf(name="", view=ToolView, attr="run", permission="system", context="nive.tools.example.tool") ] class tool(Tool): def _Run(self, **values): result = u"<h1>OK</h1>" return result
mails as list with [(email, name),...] ("*****@*****.**","Name") """ import types, string import time import logging from smtplib import SMTPServerDisconnected, SMTPRecipientsRefused, SMTPHeloError, SMTPSenderRefused, SMTPDataError, SMTPException from nive.utils.utils import ConvertToList from nive.definitions import ConfigurationError from nive.definitions import ToolConf, FieldConf from nive.tools import Tool from nive.i18n import _ configuration = ToolConf() configuration.id = "sendMail" configuration.context = "nive.components.tools.sendMail.sendMail" configuration.name = _(u"Send mails to registered users") configuration.description = __doc__ configuration.apply = None configuration.data = [ FieldConf(id="host", name=_(u"SMTP host"), datatype="string", required=1, readonly=1, default=u"", description=u""), FieldConf(id="port", name=_(u"SMTP port"), datatype="number", required=1, readonly=1, default=21, description=u""), FieldConf(id="sender", name=_(u"SMTP sender mail"),datatype="email", required=1, readonly=1, default=u"", description=u""), FieldConf(id="user", name=_(u"SMTP user"), datatype="string", required=0, readonly=1, default=u"", description=u""), FieldConf(id="pass_", name=_(u"SMTP password"), datatype="password", required=0, readonly=1, default=u"", description=u""), FieldConf(id="sendername",name=_(u"Sender name"), datatype="string", required=0, readonly=0, default=u"", description=u""), FieldConf(id="fromMail", name=_(u"Sender mail"), datatype="string", required=0, readonly=0, default=u"", description=u""),
import types from pyramid.i18n import get_localizer from pyramid.threadlocal import get_current_request from nive.tools import Tool from nive.helper import FakeLocalizer from nive.definitions import ToolConf, IApplication from nive.i18n import _ from nive.utils.utils import FormatBytesForDisplay configuration = ToolConf() configuration.id = "statistics" configuration.context = "nive.components.tools.statistics.statistics" configuration.name = _(u"Database Statistics") configuration.description = _("This function provides a short summary of stored data items.") configuration.apply = (IApplication,) configuration.data = [ ] configuration.mimetype = "text/html" class statistics(Tool): """ """
# __doc__ = """ Test version of nive.tools.sendMail. Use `sendMailTester` as a replacement for `sendMail` in tests or to disable actual mail delivery """ import logging from nive.utils.utils import ConvertToList from nive.definitions import ToolConf from nive.tools.sendMail import sendMail from nive.i18n import _ configuration = ToolConf("nive.tools.sendMail", context="nive.tools.sendMailTester.sendMailTester", name=_(u"Fake Mailer"), description=__doc__) class sendMailTester(sendMail): def _Run(self, **values): """ """ host = values.get("host") port = values.get("port") sender = values.get("sender") user = values.get("user") pass_ = values.get("pass_") fromName = values.get("fromName")
# 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/>. #---------------------------------------------------------------------- __doc__ = "" import types from nive.tools import Tool from nive.definitions import ToolConf, FieldConf, IApplication, MetaTbl, Structure from nive.i18n import _ configuration = ToolConf() configuration.id = "dbSqldataDump" configuration.context = "nive.components.tools.dbSqldataDump.dbSqldataDump" configuration.name = _(u"Database sql dump") configuration.description = _("This function only dumps table contents and skips 'create table' statements.") configuration.apply = (IApplication,) configuration.data = [ FieldConf(id="excludeSystem", datatype="mcheckboxes", default=[], listItems=[{"id":"pool_sys", "name":"pool_sys"},{"id":"pool_fulltext","name":"pool_fulltext"}], name=_(u"Exclude system columns")) ] configuration.mimetype = "text/sql" class dbSqldataDump(Tool): """
e = list(e) e.append(extension) c.unlock() c.extensions = tuple(e) c.lock() add(app.GetAllRootConfs()) add(app.GetAllObjectConfs()) toolconf = ToolConf( id = "updatefulltext", context = "nive_cms.extensions.fulltextpage.RewriteFulltext", name = _(u"Rewrite fulltext index"), description = _("Delete and rewrite the fulltext index."), apply = (IApplication,), mimetype = "text/html", data = [], views = [ ViewConf(name="", view=ToolView, attr="form", permission="system", context="nive_cms.extensions.fulltextpage.RewriteFulltext") ] ) configuration = ModuleConf( id = "pagefulltext", name = u"Web page fulltext extension", context = PageFulltext, events = (Conf(event="startRegistration", callback=SetupFulltext),), modules = [toolconf] )
configuration = ToolConf( id="exportJson", context="nive.tools.exportJson.exportJson", name=_(u"Json data export"), description= _("This function exports all objects in json format. Optionally as flat list or tree structure. This is not a simple database table dump. Object events will be triggered before exporting data." ), apply=(IApplication, ), mimetype="text/json", data=[ FieldConf( id="tree", datatype="bool", default=1, listItems=[{ "id": "true", "name": "Tree" }, { "id": "false", "name": "Flat list" }], name=_(u"Export as tree"), description= _(u"Export objects as tree structure (contained objects are included as 'items')" )), FieldConf( id="filedata", datatype="radio", default="none", listItems=[ { "id": "none", "name": "Only file information (No file data)" }, { "id": "path", "name": "Only file information and local paths (No file data)" }, { "id": "data", "name": "Include all file data" }, ], name=_(u"File data"), description=_( u"Include binary file data in json export (encoded as base64)") ) ], views=[ ViewConf(name="", view=ToolView, attr="form", permission="system", context="nive.tools.exportJson.exportJson"), ])
if e == None: e = [] elif extension in e: continue if isinstance(e, tuple): e = list(e) e.append(extension) c.unlock() c.extensions = tuple(e) c.lock() add(app.GetAllRootConfs()) add(app.GetAllObjectConfs()) toolconf = ToolConf( id="updatefulltext", context="nive.components.extensions.fulltextpage.RewriteFulltext", name=_(u"Rewrite fulltext index"), description=_("Delete and rewrite the fulltext index."), apply=(IApplication, ), data=[], mimetype="text/html") configuration = ModuleConf(id="pagefulltext", name=u"Web page fulltext extension", context=PageFulltext, events=(Conf(event="startRegistration", callback=SetupFulltext), ), modules=[toolconf])
configuration = ToolConf( id="dbJsonDump", context="nive.tools.dbJsonDump.dbJsonDump", name=_(u"Database json dump"), description= _("This function dumps table contents the way records are stored in json format." ), apply=(IApplication, ), mimetype="text/json", data=[ FieldConf(id="excludeSystem", datatype="checkbox", default=[], listItems=[{ "id": "pool_sys", "name": "pool_sys" }, { "id": "pool_fulltext", "name": "pool_fulltext" }], name=_(u"Exclude system columns")) ], views=[ ViewConf(name="", view=ToolView, attr="form", permission="system", context="nive.tools.dbJsonDump.dbJsonDump") ])
# 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/>. #---------------------------------------------------------------------- __doc__ = "" import types from nive.tools import Tool from nive.definitions import ToolConf, FieldConf configuration = ToolConf() configuration.id = "exampletool" configuration.context = "nive.components.tools.example.tool" configuration.name = u"Empty tool for tests" configuration.description = "" configuration.apply = None #(IApplication,) configuration.data = [ FieldConf( **{ "id": "parameter1", "datatype": "bool", "required": 0, "readonly": 0, "default": 0, "name": u"Show 1", "description": u"Display 1"