• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python register.registerClass函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中register.registerClass函数的典型用法代码示例。如果您正苦于以下问题:Python registerClass函数的具体用法?Python registerClass怎么用?Python registerClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了registerClass函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:issuechoice.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:eventblankdtml.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:29,代码来源:objectcompoundcontroller.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:freightcompanycreator.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:inputint.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:calculator.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:inputfloat.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:tableecom.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:simpletable.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:simplelist.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:listmailer.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:eventmanager.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:22,代码来源:catalogconfig.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:24,代码来源:watchdog.py


示例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)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:calculatorwatcher.py


示例16: createBTreeLength

    
    security.declarePrivate('createBTreeLength')
    def createBTreeLength(self):
        "remove Filters that are not being used"
        if self.records is not None:
            length = BTrees.Length.Length()
            length.set(len(self.records))
            self.setObject('recordsLength', length)
            
        if self.archive is not None:
            length = BTrees.Length.Length()
            length.set(len(self.archive))
            self.setObject('archiveLength', length)
    createBTreeLength = utility.upgradeLimit(createBTreeLength, 164)

    security.declarePrivate('convertDictToPersistentMapping')
    def convertDictToPersistentMapping(self):
        "convert the dictionaries we have stored to persistent mapping so they can be deactivated"
        if self.records is not None:
            for key,value in com.db.subTrans(self.records.items(), 500):
                self.records[key] = persistent.mapping.PersistentMapping(value)
        
        if self.archive is not None:
            for key,value in com.db.subTrans(self.archive.items(), 500):
                self.archive[key] = persistent.mapping.PersistentMapping(value)
    convertDictToPersistentMapping = utility.upgradeLimit(convertDictToPersistentMapping, 167)

Globals.InitializeClass(DataRecorder)
import register
register.registerClass(DataRecorder)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:29,代码来源:datarecorder.py


示例17: repr

            batch = StringIO.StringIO(batch)
            batch.name = '%s.csv' % repr(time.time()).replace('.', '_')
            data = [ ('echo_id', userName),
              ('merchant_pin',self.password),
              ('allow_duplicates','n'),
              ('batch_file',batch)]
            req = urllib2.Request('https://wwws.echo-inc.com/echonlinebatch/upload.asp', data)
            result = urllib2.urlopen(req).read()
            if self.validEchoSubmission(result):
                self.markProcessedOrders(orders)
            return result

    def validEchoSubmission(self,result):
        "check if this is a valid echo result for a submission so we can mark the orders as processed"
        #This is the first line that is sent for a valid transmission so lets check for that
        return result.startswith('Filename,Records,Bytes,BatchId,TraceFile')

    def validEchoResponse(self,response):
        "check if this is a valid echo result for a submission so we can mark the orders as processed"
        #This is the first line that is sent for a valid transmission so lets check for that
        return response.startswith('ID,Date,Time,TC,ECHO-ID,PAN,ExpDt,Amount,Status,AuthOrErr,AvsStatus,OrderNumber,Line,TraceCode')

    def validECHOTransaction(self,result):
        "check that we have a valid transaction to query echo for to get the results of the first submission"
        #This is the first line that is sent for a valid transmission so lets check for that
        return result.startswith('Filename,Records,Bytes,BatchId,TraceFile')

Globals.InitializeClass(CreditCardECHO)
import register
register.registerClass(CreditCardECHO)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:creditcardecho.py


示例18: ClassSecurityInfo

    security = ClassSecurityInfo()
    meta_type = "FreightClass"
    freightClass = ""

    security.declareProtected("View management screens", "edit")

    def edit(self, *args, **kw):
        "Inline edit short object"
        temp = []
        temp.append("<p>")
        temp.append(self.freightClass)
        temp.append(self.price.edit())
        temp.append("</p>")
        return "".join(temp)

    security.declarePrivate("editOutput")

    def editOutput(self):
        "return a structure that another object can use to render the information relevent to this document"
        return [self.freightClass, self.price.edit()]

    security.declarePrivate("instance")
    instance = (("price", ("create", "Money")),)


Globals.InitializeClass(FreightClass)
import register

register.registerClass(FreightClass)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:29,代码来源:freightclass.py


示例19: upgraderFixAgents

    upgraderChangeTupleTreeAgent = utility.upgradeLimit(upgraderChangeTupleTreeAgent, 141)

    security.declarePrivate("upgraderFixAgents")

    def upgraderFixAgents(self):
        "Fix the useragent detection vars to use the newer DisplayUserAgent object"
        if self.hasObject("clients") and self.clients is not None:
            self.gen_vars()
            mapping = self.UserAgent.clientSetMapping()
            for key, value in mapping.items():
                if key and value:
                    mapping[key] = getattr(self.UserAgent, value)()
                else:
                    del mapping[key]
            for setname, clients in mapping.items():
                if self.clients == clients:
                    self.UserAgent.setused = setname
                    self.delObjects(["clients"])
                    break
            if self.hasObject("clients") and self.clients is not None:
                self.UserAgent.setClients(self.clients)
                self.delObjects(["clients"])

    upgraderFixAgents = utility.upgradeLimit(upgraderFixAgents, 141)


Globals.InitializeClass(DisplayFilter)
import register

register.registerClass(DisplayFilter)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:displayfilter.py


示例20: getattr

        records = getattr(self, self.useCatalog)(meta_type='CompoundDoc')
        return [self.embedRemoteObject(cdoc, path, mymode, view, profile, drawid) for cdoc in com.catalog.catalogIter(records)]

    security.declarePrivate('PrincipiaSearchSource')
    def PrincipiaSearchSource(self):
        "This is the basic search function"
        return ''            
            
    security.declareProtected('View', 'view')
    def view(self):
        "Inline draw view"
        mymode = self.viewMode
        view = self.viewName
        path = self.viewObjectPath
        profile = self.viewProfile
        drawid = self.viewId

        #Fast abort so we don't dispatch to a bunch of other methods for something that can't draw
        if mymode not in self.modes:
            return ''

        temp = []
        for cdoc in com.catalog.catalogIter(getattr(self, self.useCatalog)(meta_type='CompoundDoc')):
            temp.append(self.embedRemoteObject(cdoc, path, mymode, view, profile, drawid))
        return ''.join(temp)


Globals.InitializeClass(CatalogCompoundController)
import register
register.registerClass(CatalogCompoundController)
开发者ID:Immudzen,项目名称:CompoundDoc,代码行数:30,代码来源:catalogcompoundcontroller.py



注:本文中的register.registerClass函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python register.Register类代码示例发布时间:2022-05-26
下一篇:
Python region.Region类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap