Replaces "*" with the actual field names. Fields from related tables keep the " ." prefix.
(table, fields=[])
| 1351 | XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" |
| 1352 | |
| 1353 | def _unpack_fields(table, fields=[]): |
| 1354 | """ Replaces "*" with the actual field names. |
| 1355 | Fields from related tables keep the "<tablename>." prefix. |
| 1356 | """ |
| 1357 | u = [] |
| 1358 | for f in fields: |
| 1359 | a, b = "." in f and f.split(".", 1) or (table.name, f) |
| 1360 | if a == table.name and b == ALL: |
| 1361 | # <table>.* |
| 1362 | u.extend(f for f in table.db.tables[a].fields) |
| 1363 | elif a != table.name and b == ALL: |
| 1364 | # <related-table>.* |
| 1365 | u.extend("%s.%s" % (a, f) for f in table.db.tables[a].fields) |
| 1366 | elif a != table.name: |
| 1367 | # <related-table>.<field> |
| 1368 | u.append("%s.%s" % (a, b)) |
| 1369 | else: |
| 1370 | # <field> |
| 1371 | u.append(b) |
| 1372 | return u |
| 1373 | |
| 1374 | def xml_format(a): |
| 1375 | """ Returns the given attribute (string, int, float, bool, None) as a quoted unicode string. |