本文整理汇总了Python中register.registerClass函数的典型用法代码示例。如果您正苦于以下问题:Python registerClass函数的具体用法?Python registerClass怎么用?Python registerClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerClass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IssueChoice
from AccessControl import ClassSecurityInfo
import Globals
from userobject import UserObject
class IssueChoice(UserObject):
"this object represents a choice within an issue"
security = ClassSecurityInfo()
meta_type = "IssueChoice"
data = ''
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit short object"
return '<p>Choice Text: %s</p>' % self.editDataStructure()
security.declarePrivate('editDataStructure')
def editDataStructure(self):
"return a data structure that contains what is needed to edit this object instead of a string"
return self.input_text('data', self.data)
security.declareProtected('View', 'view')
def view(self):
"Inline draw view"
return self.data
Globals.InitializeClass(IssueChoice)
import register
register.registerClass(IssueChoice)
示例2: len
"process the edits"
allowedIds = dict.pop('allowedIds', None)
if allowedIds is not None:
formAllowedIds = allowedIds.split()
if not len(formAllowedIds):
formAllowedIds = None
self.setObject('allowedIds',formAllowedIds)
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit view"
return '<p>DTML string to run: %s </p><p>Allowed Object Ids: %s </p>' % (
self.input_text('dtmlstring', self.getDTMLString()),
self.input_text('allowedIds', ' '.join(self.getAllowedIds())))
security.declarePrivate('getAllowedIds')
def getAllowedIds(self):
"Return all the allowed object ids"
if self.allowedIds is not None:
return self.allowedIds
return []
security.declarePrivate('getDTMLString')
def getDTMLString(self):
"return the dtml string that can be run"
return getattr(self, 'dtmlstring')
Globals.InitializeClass(EventBlankDTML)
import register
register.registerClass(EventBlankDTML)
示例3: drawPrimaryDropDown
dropDownPath, loadText, enableLoadButton = self.drawDropDownPathControls(documents, dropDownScript, **kw)
if dropDownPath:
temp.append(dropDownPath)
else:
temp.append(self.drawPrimaryDropDown(documents))
temp.append(self.drawAlternateDropDown(documents))
if loadText is None:
loadText = 'Load Document'
if enableLoadButton:
temp.append(self.submitChanges(loadText))
return ''.join(temp)
security.declarePrivate('drawPrimaryDropDown')
def drawPrimaryDropDown(self, docs):
"draw the primary drop down"
js = 'onchange="submit()"'
seq = [(name, name) for (name, i) in docs]
seq.insert(0, ('', 'Load Document') )
return self.option_select(seq, 'selectedDocument', dataType='list:ignore_empty', events=js)
security.declarePrivate('drawAlternateDropDown')
def drawAlternateDropDown(self, docs):
"draw the alternate drop down"
return ''
Globals.InitializeClass(ObjectCompoundController)
import register
register.registerClass(ObjectCompoundController)
示例4: ClassSecurityInfo
security = ClassSecurityInfo()
meta_type = "FreightCompanyCreator"
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit short object"
temp = []
temp.append('<p>Freight Companies</p>')
temp.append(self.freightCompanies.edit())
temp.append('<p>Freight Classes</p>')
temp.append(self.freightClasses.edit())
return ''.join(temp)
security.declarePrivate('instance')
instance = (('freightCompanies', ('create', 'ListText')),('freightClasses',('create', 'ListText')))
security.declarePrivate('getFreightCompanies')
def getFreightCompanies(self):
"return the freight companies that we have"
return self.freightCompanies.getAvailableListsContents()
security.declarePrivate('getFreightClasses')
def getFreightClasses(self):
"return the freight classes that we have"
return self.freightClasses.getAvailableListsContents()
Globals.InitializeClass(FreightCompanyCreator)
import register
register.registerClass(FreightCompanyCreator)
示例5: edit
def edit(self, pageId=None, *args, **kw):
"Inline edit short object"
temp = []
if self.calculated is not None:
temp.append(str(self.calculated))
temp.append(self.input_number('data', self.data, pageId=pageId))
return ''.join(temp)
security.declareProtected('View', 'view')
def view(self):
"Inline draw view"
return self.int()
security.declareProtected('Change CompoundDoc', 'setCalculationValue')
def setCalculationValue(self, value):
"set the calculation value of this object"
if value and isinstance(value, types.FloatType):
self.setObject('calculated', int(value))
security.declarePrivate('populatorLoader')
def populatorLoader(self, string):
"load the data into this object if it matches me"
try:
self.setObject('data', int(string))
except ValueError:
pass
Globals.InitializeClass(InputInt)
import register
register.registerClass(InputInt)
示例6: ammountMultiply
security.declarePrivate('ammountMultiply')
def ammountMultiply(self, remote):
"multiply the item by this ammount"
return self.getTraversedObjectValue(remote) * self.ammount
security.declarePrivate('getTraversedObjectValue')
def getTraversedObjectValue(self, remote):
"return the floating point value of the returned object"
object = self.getTraversedObject(remote)
if object is None:
return 0.0
if object.hasObject('float'):
return object.float()
elif callable(object):
return float(object())
else:
return float(object)
security.declarePrivate('getTraversedObject')
def getTraversedObject(self, remote):
"get the remote object and return it"
if not self.objectPath:
return None
object = remote.restrictedTraverse(self.objectPath)
if object is not None:
return object
Globals.InitializeClass(Calculator)
import register
register.registerClass(Calculator)
示例7: edit
def edit(self, *args, **kw):
"Inline edit short object"
temp = []
if self.calculated is not None:
temp.append(str(self.calculated))
temp.append(self.input_float('data', self.data))
return ''.join(temp)
security.declareProtected('View', 'view')
def view(self):
"Inline draw view"
return self.float()
security.declareProtected('Change CompoundDoc', 'setCalculationValue')
def setCalculationValue(self, value):
"set the calculation value of this object"
if value and isinstance(value, types.FloatType):
self.setObject('calculated', value)
security.declarePrivate('populatorLoader')
def populatorLoader(self, string):
"load the data into this object if it matches me"
try:
self.setObject('data', float(string))
except ValueError:
pass
Globals.InitializeClass(InputFloat)
import register
register.registerClass(InputFloat)
示例8: calcRowBuy
else:
temp.append('%.2f' % currentPrice)
return temp
security.declarePrivate('calcRow')
def calcRowBuy(self, seq, quantity, basePrice, ecom, func=None):
prices = []
quantities = []
format = '<a href="%s/add?quantity=%s">%s</a>'
ecomUrl = ecom.absolute_url()
for percent,number in zip(seq,quantity):
if percent is not None and number is not None:
currentPrice = (basePrice*(100-percent))/100
if currentPrice > 0:
stringPrice = '%.2f' % currentPrice
prices.append(format % (ecomUrl, number, stringPrice))
quantities.append(number)
return [quantities, prices]
security.declarePrivate('instance')
instance = (('SessionManagerConfig', ('create', 'SessionManagerConfig')),)
security.declarePrivate('PrincipiaSearchSource')
def PrincipiaSearchSource(self):
"Return what can be search which is nothing"
return ''
Globals.InitializeClass(TableEcom)
import register
register.registerClass(TableEcom)
示例9: getRows
self.setObject("table", table)
security.declarePrivate("getRows")
def getRows(self):
"get all the rows of this document"
if self.table is not None:
return self.table
return [[]]
security.declareProtected("View", "view")
def view(self):
"Render page"
return self.createTable(self.getRows())
classConfig = {}
classConfig["cols"] = {"name": "How many columns?", "type": "int"}
security.declarePrivate("PrincipiaSearchSource")
def PrincipiaSearchSource(self):
"This is the basic search function"
return ""
Globals.InitializeClass(SimpleTable)
import register
register.registerClass(SimpleTable)
示例10: view
return ''.join(temp)
security.declareProtected('View', 'view')
def view(self):
"Inline draw view"
return self.unorderedList(self.getEntries())
security.declarePrivate('PrincipiaSearchSource')
def PrincipiaSearchSource(self):
"This is the basic search function"
return ' '.join(self.getEntries())
security.declarePrivate('classUpgrader')
def classUpgrader(self):
"upgrade this class"
self.convertListToOOTreeSet()
security.declarePrivate('convertListToOOTreeSet')
def convertListToOOTreeSet(self):
"conver the list object to an OOTreeSet"
if len(self.entry) and isinstance(self.entry, types.ListType):
temp = OOTreeSet()
for i in self.entry:
temp.insert(i)
self.setObject('entry', temp)
convertListToOOTreeSet = utility.upgradeLimit(convertListToOOTreeSet, 141)
Globals.InitializeClass(SimpleList)
import register
register.registerClass(SimpleList)
示例11: getattr
listName = self.listName
if listName:
addresses = getattr(self.getCompoundDoc(), listName)
message = '%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n' % (self.header, self.message, self.footer)
message = DTML(message)
From = self.listFrom
Subject = self.subject
server = smtplib.SMTP(self.server)
msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s")
for address in addresses.getEntries():
message = message(self, self.REQUEST, address=address)
server.sendmail(From, address, msg % (From, address, Subject, message))
server.quit()
security.declarePrivate('classUpgrader')
def classUpgrader(self):
"upgrade this class"
self.fixFrom()
security.declarePrivate('fixFrom')
def fixFrom(self):
"fix the from attribute"
if 'from' in self.__dict__:
self.listFrom = getattr(self, 'from')
self.delObjects(['from'])
fixFrom = utility.upgradeLimit(fixFrom, 141)
Globals.InitializeClass(ListMailer)
import register
register.registerClass(ListMailer)
示例12: EventManager
import Globals
import utility
from baseevent import BaseEvent
class EventManager(base.Base):
"EventManager manages all Events"
meta_type = "EventManager"
security = ClassSecurityInfo()
overwrite=1
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit view"
temp = []
temp.append('<div class="outline">')
for i in self.getAllEvents():
temp.append(i.edit())
temp.append("</div>")
return ''.join(temp)
security.declarePrivate("getAllEvents")
def getAllEvents(self):
"Return a list of all items that are a BaseEvent"
return [object for object in self.objectValues() if utility.isinstance(object, BaseEvent)]
Globals.InitializeClass(EventManager)
import register
register.registerClass(EventManager)
示例13: CatalogConfig
import baseobject
# For Security control and init
from AccessControl import ClassSecurityInfo
import Globals
class CatalogConfig(baseobject.BaseObject):
"CatalogConfig tracks how this objects work with different Catalogs"
"""This object is now obsolete and when the CatalogManager is updated it will take the data
it needs and then delete the CatalogConfig objects it has"""
meta_type = "CatalogConfig"
security = ClassSecurityInfo()
overwrite = 1
useCatalog = ""
Globals.InitializeClass(CatalogConfig)
import register
register.registerClass(CatalogConfig)
示例14: WatchDog
#This software is released under GNU public license. See details in the URL:
#http://www.gnu.org/copyleft/gpl.html
#For Security control and init
from AccessControl import ClassSecurityInfo
import Globals
from userobject import UserObject
class WatchDog(UserObject):
"""WatchDog class This class is designed to monitor other objects and
keep information about who changed it and when etc."""
security = ClassSecurityInfo()
meta_type = "WatchDog"
security.declarePrivate('classUpgrader')
def classUpgrader(self):
"upgrade this class which is to delete it"
self.getCompoundDoc().delObjects([self.getId()])
Globals.InitializeClass(WatchDog)
import register
register.registerClass(WatchDog)
示例15: getattr
calculated.setCalculationValue(calculator.calculate(self))
paths = [i.getPhysicalPath() for i in self.objectValues(self.creationType)]
for id in calculatorcontainer.objectOrder:
traversedObject = getattr(calculatorcontainer, id).getTraversedObject(self)
if traversedObject is not None and traversedObject.getPhysicalPath() not in paths:
traversedObject.observerAttached(self)
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit view"
temp = []
format = "<p>ID: %s %s</p>"
if self.calculatorPath:
calculatorContainer = self.getRemoteObject(self.calculatorPath, 'CalculatorContainer')
if calculatorContainer is not None:
for id in calculatorContainer.objectOrder:
object = getattr(self, id, None)
if object is not None:
temp.append(format % (object.getId(), object.edit()))
return ''.join(temp)
security.declarePrivate('eventProfileLast')
def eventProfileLast(self):
"run this event as the last thing the object will do before the profile is returned"
self.delObjects([id for id in self.objectIds(self.creationType)]+['observed'])
self.observerUpdate()
Globals.InitializeClass(CalculatorWatcher)
import register
register.registerClass(CalculatorWatcher)