"""Common subpackage of cubicweb : defines library functions used both on thehg stserver side and on the client side:organization: Logilab:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr"""fromlogilab.common.adbhimportFunctionDescrfromcubicweb._exceptionsimport*# bw compatfromrql.utilsimportregister_function,iter_funcnode_variablesclassCOMMA_JOIN(FunctionDescr):supported_backends=('postgres','sqlite',)rtype='String'@classmethoddefst_description(cls,funcnode):return', '.join(term.get_description()forterminiter_funcnode_variables(funcnode))register_function(COMMA_JOIN)# XXX do not expose?classCONCAT_STRINGS(COMMA_JOIN):aggregat=Trueregister_function(CONCAT_STRINGS)# XXX bw compatclassGROUP_CONCAT(CONCAT_STRINGS):supported_backends=('mysql','postgres','sqlite',)register_function(GROUP_CONCAT)classLIMIT_SIZE(FunctionDescr):supported_backends=('postgres','sqlite',)rtype='String'@classmethoddefst_description(cls,funcnode):returnfuncnode.children[0].get_description()register_function(LIMIT_SIZE)classTEXT_LIMIT_SIZE(LIMIT_SIZE):supported_backends=('mysql','postgres','sqlite',)register_function(TEXT_LIMIT_SIZE)