Commit graph

9 commits

Author SHA1 Message Date
Robert McQueen
20bcbaf21f 2005-10-29 Robert McQueen <robot101@debian.org>
* python/decorators.py: Add optional arguments to the method and
        signal decorators to allow you to specify the signature of arguments
        and return values. Preserve the doc strings of signal functions in the
        decorated version, for pydoc and friends.

        * python/dbus_bindings.pyx, python/proxies.py: Replace the
        parse_signature_block function with an iterable dbus.Signature()
        type. Fix a bug in MessageIter.append_strict where you could append
        anything by claiming it was a string.

        * python/service.py: Use the out_signature decoration on methods to
        marshal return values, meaning you no longer require dbus.Array()
        or dbus.Dictionary() to indicate the type when returning empty
        arrays or dictionaries. Fix a bug where exceptions which are defined
        in __main__ are not turned into error replies.

        * test/python/test-client.py, test/python/test-service.py: Add test
        for correct marshalling of return values according to out_signature.
        Fix a bug in the async call test where the error_handler is missing a
        self argument.
2005-10-29 19:13:17 +00:00
Robert McQueen
2d74492ba2 2005-10-29 Robert McQueen <robot101@debian.org>
* glib/Makefile.am, glib/examples/Makefile.am,
        glib/examples/statemachine/Makefile.am: Merge patch from Ubuntu by
        Daniel Stone to replace explicit calls to libtool with $(LIBTOOL).

        * test/python/.cvsignore: Add run-with-tmp-session-bus.conf.

        * tools/dbus-monitor.1, tools/dbus-monitor.c: Merge dbus-monitor patch
        from Ubuntu by Daniel Silverstone to allow specifying match rules on
        the command line.
2005-10-29 17:02:58 +00:00
Robert McQueen
ef47e01f75 2005-10-24 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx (String, MessageIter): make D-Bus strings
    derive from unicode instead of str, and encode/decode UTF-8 when
    marshalling/unmarshalling bus messages

    * python/introspect_parser.py: encode introspection data as UTF-8
    before passing the buffer into libxml2

    * test/python/test-client.py: add unicode test strings

    * test/data/valid-service-files/.cvsignore, test/python/.cvsignore:
    ignore generated python test files
2005-10-24 18:29:50 +00:00
John (J5) Palmieri
2b9417707a * glib/dbus-gvalue-utils.c (hash_free_from_gtype): handle gdouble
and G_TYPE_VALUE_ARRAY (DBUS_TYPE_STRUCT)
(gvalue_from_hash_value, hash_value_from_gvalue): handle gdouble

* glib/dbus-gvalue.c (dbus_gvalue_to_signature): add missing
DBUS_STRUCT_BEGIN_CHAR and DBUS_STRUCT_END_CHAR charaters
when constructing struct signatures

* python/_dbus.py (Bus): handle private connections using the
private keyword in the constructor. defaults to private=False
(Bus::close): new method to close a connection to the bus

* python/dbus_bindings.pyx (Connection::close): renamed method
was previously called disconnect
(bus_get): now supports getting a private connection

* python/proxies.py (ProxyMethod::__call__): check if ignore_reply
keyword is set to True.  if it is, execute the method without waiting
for a reply
(ProxyObject::_introspect_execute_queue): new method for executing
all the pending methods that were waiting for the introspect to
finish.  this is called when introspect either succeeds or fails
(ProxyObject::_introspect_error_handler): call queued methods
2005-10-18 04:38:05 +00:00
John (J5) Palmieri
0ae9f138ad * python/dbus_bindings.pyx (MessageIter::append_strict): check for
STRUCT_BEGIN not TYPE_STRUCT in indicate we are marshalling a struct

* python/service.py (Object::_message_cb): handle exceptions correctly
  by sending them over the wire to the calling app.  This makes sure
  the client returns immediately instead of waiting the 15 seconds to
  timeout.

* test/python/test-client.py (TestDBusBindings::testBenchmarkIntrospect):
  Add a test to benchmark how long it takes to introspect a service and
  call a method which returns a large element (pretty fast)

* test/python/test-service.py (TestObject::GetComplexArray): new test
  method which pushes a lot of data
2005-10-14 21:44:00 +00:00
John (J5) Palmieri
86b9f6ad4a * glib/dbus-gvalue.c (marshal_variant): call _dbus_gvalue_marshal
instead of marshal basic so we can handle recursive types in a variant

* test/glib/test-dbus-glib.c: Add test for marshaling recurive types
  in variants

* test/glib/test-service-glib.c, test-service-glib.xml
  (my_object_echo_variant [EchoVariant],
  my_object_process_variant_of_array_of_ints123
  [ProcessVariantOfArrayOfInts123]):
  Add two test methods

* python/introspect_parser.py: New module for parsing introspect
  data.

* python/dbus_bindings.pyx:
  (various places): when throwing errors fix to use errormsg instead
  of message local variable because Pyrex can get confused with other
  message variables (initial patch by Robert McQueen
  <robert.mcqueen at collabora.co.uk>)
  (MessageIter::parse_signature_block): new method for getting the next
  block in a signiture.
  (MessageIter::append_strict): new method for appending values strictly
  using the passed in signature instead of guessing at the type
  (MessageItter:: append_dict, append_struct, append_array): use
  signatures to marshal children if the signature is available

* python/exceptions.py (IntrospectionParserException): new exception

* python/proxies.py (ProxyMethod::__call__): Marshal args with
  introspected signatures if available, else we fall back to the
  old way of doing things.
  (ProxyObject::_introspect_reply_handler ): parse introspection data

* python/service.py (ObjectType::_reflect_on_method): Properly
  terminate <method> if there are no args in the reflection data

* test/python/test-client.py: add tests for talking with the GLib
  test server.  This gives us better coverage for introspection since
  python to python will always generate arguments as variants.  It also
  allows us to test the robustness of the GLib bindings and interlanguage
  communications.
2005-10-05 20:43:46 +00:00
John (J5) Palmieri
236c7b7384 * python/Makefile.am: Break on pyrexc errors instead of ignoring them
* python/dbus_bindings.pyx: Memory management foo
(global): remove hacky _user_data_references global list
(GIL_safe_cunregister_function_handler): userdata now stuffed into
tuples. Unref user_data
(GIL_safe_cmessage_function_handler): userdata now stuffed into tuples
(Connection::__del__): Remove and replace with __dealloc__ method
(Connection::add_filter): Stuff user_data into a tuple.  Use Py_INCREF
to keep tuple from being deallocated instead of the global var hack
(Connection::register_object_path): Stuff user_data into a tuple.
Use Py_INCREF to keep tuple from being deallocated instead of the
global var hack
(Connection::register_fallback): Stuff user_data into a tuple.
Use Py_INCREF to keep tuple from being deallocated instead of the
global var hack
(GIL_safe_pending_call_notification): Don't unref the message
because it gets unreffed when going out of scope.  Py_XDECREF
the user_data
(PendingCall::__del__): Remove and replace with __dealloc__ method
(PendingCall::set_notify): ref the pending call because we will
need it to stick around for when the notify callback gets called
(Message::__del__): Remove and replace with __dealloc__ method

* python/dbus_glib_bindings.pyx (init_gthreads): Changed to
gthreads_init to match up with the dbus call

* python/glib.py (init_threads): Changed to threads_init to match
up with gobject.threads_init().  init_threads is kept for backwards
compat but will most likely be deprecated in the future

* test/python/test-client.py:
- revamp to use Python's unittest functionality
- add async call tests
- setup threads in glib and dbus so we make sure locks are working
2005-09-01 01:22:06 +00:00
John (J5) Palmieri
18170dd986 * s/Message(_create=0)/EmptyMessage everywhere else
* test/python/test-{server|client}.py: add the python/.libs directory
  to the lookup path so dbus_bindings and dbus_glib_bindings don't
  get picked up from the system
2005-08-26 04:23:33 +00:00
John (J5) Palmieri
781b0cdef9 * test/python: Add python regression test
* configure.in: Add test/python/Makefile

* test/Makefile.am: Add the python directory to SUBDIRS
2005-08-25 00:20:41 +00:00