当前位置: 首页>>代码示例>>Python>>正文


Python pyamf.register_package函数代码示例

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


在下文中一共展示了register_package函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_strict

    def test_strict(self):
        self.module.Spam = Spam

        Spam.__module__ = self.spam_module

        r = pyamf.register_package(self.module, 'com.example', strict=True)
        self.check_module(r, 'com.example.')
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_basic.py

示例2: test_all

    def test_all(self):
        self.module.Spam = Spam

        self.module.__all__ = ['Classic', 'New']

        r = pyamf.register_package(self.module, 'com.example')
        self.check_module(r, 'com.example.')
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_basic.py

示例3: test_name

    def test_name(self):
        self.module.__name__ = 'spam.eggs'
        self.ClassicType.__module__ = 'spam.eggs'
        self.NewType.__module__ = 'spam.eggs'

        r = pyamf.register_package(self.module)
        self.check_module(r, 'spam.eggs.')
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_basic.py

示例4: getLogin_amf

def getLogin_amf(database, username, password, validdata=False):
  validator = npi.getLogin(database, username, password)
  pyamf.register_package(nerva2py.models, 'models')
  if validator["valid"]==True:
    validator["engine"] = ns.engine
    validator["employee"] = ns.employee.as_dict(datetime_to_str=False)
    validator["audit"] = ArrayCollection(ns.db(ns.db.ui_audit.usergroup==ns.employee.usergroup).select().as_list(datetime_to_str=False))
    transfilter = ns.db((ns.db.link.ref_id_1==ns.employee.usergroup)
                        &(ns.db.link.nervatype_2==ns.db((ns.db.groups.groupname=="nervatype")&(ns.db.groups.groupvalue=="groups")).select()[0].id)
                        &(ns.db.link.ref_id_2.belongs(ns.db(ns.db.groups.groupname=="nervatype")._select(ns.db.groups.id)))).select()
    if len(transfilter)>0:
      validator["transfilter"] = transfilter[0].ref_id_2
    else:
      validator["transfilter"] = None
    validator["groups"] = ArrayCollection(ns.db(ns.db.groups.groupname.belongs(('usergroup', 'nervatype', 'transtype', 'inputfilter', 'transfilter', 'department', 'logstate', 'fieldtype'))).select().as_list(datetime_to_str=False))
    validator["menucmd"] = ArrayCollection(ns.db().select(ns.db.ui_menu.ALL).as_list(datetime_to_str=False))
    validator["menufields"] = ArrayCollection(ns.db().select(ns.db.ui_menufields.ALL, orderby=ns.db.ui_menufields.menu_id|ns.db.ui_menufields.orderby).as_list(datetime_to_str=False))
    userlogin = ns.db(ns.db.fieldvalue.fieldname=="log_userlogin").select()
    if len(userlogin)>0:
      validator["userlogin"] = userlogin[0].value
    else:
      validator["userlogin"] = "false"
  return validator
开发者ID:tazjel,项目名称:nerva2py,代码行数:23,代码来源:npi.py

示例5: test_not_strict

    def test_not_strict(self):
        self.module.Spam = Spam

        Spam.__module__ = self.spam_module

        r = pyamf.register_package(self.module, 'com.example', strict=False)

        self.assertEqual(len(r), 3)

        for c in [self.NewType, self.ClassicType, Spam]:
            alias = r[c]

            self.assertTrue(isinstance(alias, pyamf.ClassAlias))
            self.assertEqual(alias.klass, c)
            self.assertEqual(alias.alias, 'com.example.' + c.__name__)
开发者ID:0xmilk,项目名称:appscale,代码行数:15,代码来源:test_basic.py

示例6: test_dict

    def test_dict(self):
        """
        @see: #585
        """
        d = dict()
        d['Spam'] = Spam

        r = pyamf.register_package(d, 'com.example', strict=False)

        self.assertEqual(len(r), 1)

        alias = r[Spam]

        self.assertTrue(isinstance(alias, pyamf.ClassAlias))
        self.assertEqual(alias.klass, Spam)
        self.assertEqual(alias.alias, 'com.example.Spam')
开发者ID:0xmilk,项目名称:appscale,代码行数:16,代码来源:test_basic.py

示例7: test_list

    def test_list(self):
        class Foo:
            pass

        class Bar:
            pass

        ret = pyamf.register_package([Foo, Bar], 'spam.eggs')

        self.assertEqual(len(ret), 2)

        for c in [Foo, Bar]:
            alias = ret[c]

            self.assertTrue(isinstance(alias, pyamf.ClassAlias))
            self.assertEqual(alias.klass, c)
            self.assertEqual(alias.alias, 'spam.eggs.' + c.__name__)
开发者ID:0xmilk,项目名称:appscale,代码行数:17,代码来源:test_basic.py

示例8: test_separator

    def test_separator(self):
        r = pyamf.register_package(self.module, "com.example", separator="/")

        self.ClassicType.__module__ = "com.example"
        self.NewType.__module__ = "com.example"
        self.check_module(r, "com.example/")
开发者ID:cardmagic,项目名称:PyAMF,代码行数:6,代码来源:test_basic.py

示例9: ImageSnapshot

class ImageSnapshot(object):
    """
    This class corresponds to `mx.graphics.ImageSnapshot` on the client.
    Clients may choose to capture images and send them to the server via a
    RemoteObject call.

    :ivar contentType:  The content type for the image encoding format that
        was used to capture this snapshot.
    :type contentType: `str`
    :ivar width: The image width in pixels.
    :type width: `int`
    :ivar height: The image height in pixels.
    :type height: `int`
    :ivar properties: Additional properties of the image.
    :type properties: `dict`
    :ivar data: The encoded data representing the image snapshot.
    :type data: `file` object

    """

    def __init__(self, **kwargs):
        self.contentType = kwargs.pop('contentType', None)
        self.properties = kwargs.pop('properties', {})
        self.width = kwargs.pop('width', 0)
        self.height = kwargs.pop('height', 0)
        self.data = kwargs.pop('data', None)


pyamf.register_package(globals(), 'flex.graphics')
开发者ID:hydralabs,项目名称:plasma,代码行数:29,代码来源:graphics.py

示例10: test_ignore

    def test_ignore(self):
        self.module.Spam = Spam

        r = pyamf.register_package(self.module, 'com.example', ignore=['Spam'])
        self.check_module(r, 'com.example.')
开发者ID:0xmilk,项目名称:appscale,代码行数:5,代码来源:test_basic.py

示例11: register_package

        @type obj: L{ExternalizableClass}
        @param obj: The object in question.
        @param input: The output stream to write to.
        @type input L{DataOutput<pyamf.amf3.DataOutput>}
        """
        output.writeBoolean(True)
        output.writeBoolean(False)
        output.writeByte(0)
        output.writeByte(-1)
        output.writeByte(1)
        output.writeByte(127)
        output.writeByte(-127)
        output.writeDouble(1.0)
        output.writeFloat(2.0)
        output.writeInt(0)
        output.writeInt(-1)
        output.writeInt(1)
        output.writeMultiByte(u"\xe4\xf6\xfc\xc4\xd6\xdc\xdf", "iso-8859-1")
        output.writeMultiByte(u"\xe4\xf6\xfc\xc4\xd6\xdc\xdf", "utf8")
        output.writeObject([1, "one", 1])
        output.writeShort(0)
        output.writeShort(-1)
        output.writeShort(1)
        output.writeUnsignedInt(0)
        output.writeUnsignedInt(1)
        output.writeUTF("Hello world!")
        output.writeUTFBytes("Hello world!")


register_package(sys.modules[__name__], NAMESPACE)
开发者ID:thijstriemstra,项目名称:acidswf,代码行数:30,代码来源:data.py

示例12: test_module

 def test_module(self):
     r = pyamf.register_package(self.module, 'com.example')
     self.check_module(r, 'com.example.')
开发者ID:0xmilk,项目名称:appscale,代码行数:3,代码来源:test_basic.py

示例13: DataErrorMessage


class DataErrorMessage(messages.ErrorMessage):
    """
    Special cases of ErrorMessage will be sent when a data conflict
    occurs.

    This message provides the conflict information in addition to
    the :class:`~plasma.flex.messaging.ErrorMessage` information.

    :ivar cause: The client originated message which caused the conflict.
    :ivar propertyNames: A list of properties that were found to be
        conflicting between the client and server objects.
    :ivar serverObject: The value that the server had for the object with the
        conflicting properties.

    .. seealso:: `DataErrorMessage on Livedocs
        http://livedocs.adobe.com/flex/201/langref/mx/data/messages/DataErrorMessage.html>`_

    """

    def __init__(self, **kwargs):
        ErrorMessage.__init__(self, **kwargs)

        self.cause = kwargs.pop('cause', None)
        self.propertyNames = kwargs.pop('propertyNames', None)
        self.serverObject = kwargs.pop('serverObject', None)


pyamf.register_package(globals(), package='flex.data.messages')
开发者ID:hydralabs,项目名称:plasma,代码行数:28,代码来源:messages.py

示例14: closeSession

        session = self.session( self, protocol )
        self.sessions[ session.session_id ] = session
        session.open()
        return session

    def closeSession( self, session ):
        """ A session is closing, clean up after it """
        if ( session.session_id in self.sessions ):
            del( self.sessions[ session.session_id ] )
        if ( session.protocol.transport is not None ):
            # Could be none in the case of tests
            session.protocol.transport.loseConnection()
        pass

    def fireEvent( self, event, session ):
        """ Fire the event """
        try:
            #print event
            return event.fire( self, session )
        except Exception as e:
            traceback.print_exc(file=sys.stdout)
            # Send back an error message to the client
            reply = event.reply( ErrorEvent, e )
            session.sendEvent( reply )

    def sendGlobalEvent( self, event ):
        """ Send an event to all active sessions """
        pass

pyamf.register_package( swfconduit.event, 'swfconduit.event' );
开发者ID:doublecluepon,项目名称:SwfConduit,代码行数:30,代码来源:server.py

示例15:

port = 8000
host = 'localhost'

# Setup database
schema = persistent.Schema()
schema.createSchema()
schema.createMappers()

# Set this to True so that returned objects and arrays are bindable
amf3.use_proxies_default = True

# Map class aliases
# These same aliases must be registered in the Flash Player client
# with the registerClassAlias function.
namespace = 'org.pyamf.examples.addressbook.models'
pyamf.register_package(models, namespace)

# Map controller methods
sa_obj = controller.SAObject()
mapped_services = {
    'ExampleService': sa_obj
}


if __name__ == '__main__':
    import optparse
    import logging
    import os, sys

    from wsgiref import simple_server
    from pyamf.remoting.gateway.wsgi import WSGIGateway
开发者ID:cardmagic,项目名称:PyAMF,代码行数:31,代码来源:server.py


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