try this patch:
Index: lib/sqlalchemy/ext/declarative.py
===================================================================
--- lib/sqlalchemy/ext/declarative.py (revision 6051)
+++ lib/sqlalchemy/ext/declarative.py (working copy)
@@ -639,8 +639,9 @@
prop = synonym('col', descriptor=property(_read_prop, _write_prop))
"""
+
def decorate(fn):
- return _orm_synonym(name, map_column=map_column, descriptor=fn)
+ return util.update_wrapper(_orm_synonym(name,
map_column=map_column, descriptor=fn), fn)
return decorate
def comparable_using(comparator_factory):
@@ -661,7 +662,7 @@
"""
def decorate(fn):
- return comparable_property(comparator_factory, fn)
+ return
util.update_wrapper(comparable_property(comparator_factory, fn), fn)
return decorate
def _declarative_constructor(self, **kwargs):
Angri wrote:
>
> I think that patch which you would like to provide could add
> functools.wraps decorator to the decorator defined in synonym_for().
> See http://docs.python.org/library/functools.html#functools.wraps
>
> --
> Anton Gritsay
> http://angri.ru
>
> On 12 ÉÀÎ, 22:20, Christophe de VIENNE <[email protected]> wrote:
>> Hi,
>>
>> I noticed that when I use the @synonym_for decorator, my function
>> docstring
>> get lost.
>>
>> I got lost in SA code around the attributes.register_descriptor
>> function,
>> which is one of the steps I guess the doc is not copied (along with the
>> decorator function itself), and cannot propose a patch.
>>
>> I workaround the issue by doing the plain synonym declaration and using
>> the
>> sphinx specific docstrings for class attributes, but it would be really
>> great if it could just work.
>>
>> And thanks for the awesome tool SqlAlchemy is : it is a constant source
>> of
>> amazement to me.
>>
>> Regards,
>>
>> Christophe
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---