Hi,
I haven't tried your code, but there are currently 2 small issues with
clrtype.py I know of:
1. You cannot use iterable for @returns and @accepts - see
http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25448 I
think your issue is similar.
2. You cannot use Python classes with clrtype.ClrClass metaclass in
@accepts and @returns.
Both issues can be fixen in validate_clr_types function in clrtype.py.
Here is my version:
def validate_clr_types(signature_types, var_signature = False):
if not isinstance(signature_types, tuple):
signature_types = (signature_types,)
for t in signature_types:
clr_type = clr.GetClrType(t)
if t == Void:
raise TypeError("Void cannot be used in signature")
if clr.GetPythonType(clr_type) != t and \
clr.GetPythonType(clr_type) != clr.GetPythonType(t):
raise Exception, "Invalid CLR type %s" % str(t)
if not var_signature:
if clr_type.IsByRef:
raise TypeError("Byref can only be used as arguments and
locals")
# ArgIterator is not present in Silverlight
if hasattr(System, "ArgIterator") and t == System.ArgIterator:
raise TypeError("Stack-referencing types can only be
used as arguments and locals")
--
-- Lukás(
Simon Segal wrote:
I am curious as to how to define a
System.Collections.Generic.ICollection as per the below with
@clrtype.accepts and @clrtype.returns. Same question goes for
_clrfields where I want an ICollection<T> (c#) as a field.
@property
@clrtype.accepts()
@clrtype.returns(ICollection[Order])
def Orders(self): return self._orders
@Orders.setter
@clrtype.accepts(ICollection[Order])
@clrtype.returns()
def Orders(self, value): self._orders = value
Thanks,
Simon
------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com