示例#1
0
 def field_names(*args, **kwargs):
     prepend = ''
     if 'prepend' in kwargs:
         prepend = kwargs['prepend']+'.'
     fieldNames = exclude(settings.EXCLUDE_FIELDS,TCountry._meta.get_all_field_names())
     #return map(lambda x: prepend+x,fieldNames)
     return map(lambda x: prepend+x,fieldNames)
示例#2
0
 def field_names(*args, **kwargs):
     prepend = ''
     if 'prepend' in kwargs:
         prepend = kwargs['prepend']+'.'
     fieldNames = exclude(settings.EXCLUDE_FIELDS,TArtist._meta.get_all_field_names())
     fieldNames.extend(TCountry.field_names(**{'prepend':'citizenship'}))
     fieldNames.extend(TResource.field_names(**{'prepend':'resourceid'}))
     return map(lambda x: prepend+x,fieldNames)
示例#3
0
文件: xmlutils.py 项目: mccutchen/bhc
def add_element(parent, tagname, attrs={}, children={}, text=None):
    """Returns an ElementTree.Element object which is guaranteed to be unique,
    based on the given arguments."""

    forbiddenvalues = [None, '']
    attrs = exclude(attrs, values=forbiddenvalues)
    children = exclude(children, values=forbiddenvalues)

    el = ET.SubElement(parent, tagname, **attrs)

    if text and not attrs and not children:
        el.text = text

    for childname, value in children.items():
        if is_xml_fragment(value) and not value.startswith('<%s' % childname):
            # create a valid xml fragment
            value = '<%s>%s</%s>' % (childname, value, childname)
            child = ET.fromstring(value)
            el.append(child)
        else:
            ET.SubElement(el, childname).text = value

    return el
示例#4
0
    def update(self, data):
        columns = dict(Listing.__table__.columns)
        columns = utils.exclude(["user_id", "id"], columns)

        self.__dict__.update(utils.pick(columns, data))