Show More
@@ -31,8 +31,7 b' class wrapped(object):' | |||
|
31 | 31 | """Object requiring extra conversion prior to displaying or processing |
|
32 | 32 | as value |
|
33 | 33 | |
|
34 |
Use unwrapvalue() |
|
|
35 | object. | |
|
34 | Use unwrapvalue() or unwrapastype() to obtain the inner object. | |
|
36 | 35 | """ |
|
37 | 36 | |
|
38 | 37 | __metaclass__ = abc.ABCMeta |
@@ -434,13 +433,6 b' def hybridlist(data, name, fmt=None, gen' | |||
|
434 | 433 | prefmt = pycompat.bytestr |
|
435 | 434 | return hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % prefmt(x)) |
|
436 | 435 | |
|
437 | def unwraphybrid(context, mapping, thing): | |
|
438 | """Return an object which can be stringified possibly by using a legacy | |
|
439 | template""" | |
|
440 | if not isinstance(thing, wrapped): | |
|
441 | return thing | |
|
442 | return thing.show(context, mapping) | |
|
443 | ||
|
444 | 436 | def compatdict(context, mapping, name, data, key='key', value='value', |
|
445 | 437 | fmt=None, plural=None, separator=' '): |
|
446 | 438 | """Wrap data like hybriddict(), but also supports old-style list template |
@@ -534,7 +526,8 b' def _showcompatlist(context, mapping, na' | |||
|
534 | 526 | |
|
535 | 527 | def flatten(context, mapping, thing): |
|
536 | 528 | """Yield a single stream from a possibly nested set of iterators""" |
|
537 | thing = unwraphybrid(context, mapping, thing) | |
|
529 | if isinstance(thing, wrapped): | |
|
530 | thing = thing.show(context, mapping) | |
|
538 | 531 | if isinstance(thing, bytes): |
|
539 | 532 | yield thing |
|
540 | 533 | elif isinstance(thing, str): |
@@ -548,7 +541,8 b' def flatten(context, mapping, thing):' | |||
|
548 | 541 | yield pycompat.bytestr(thing) |
|
549 | 542 | else: |
|
550 | 543 | for i in thing: |
|
551 | i = unwraphybrid(context, mapping, i) | |
|
544 | if isinstance(i, wrapped): | |
|
545 | i = i.show(context, mapping) | |
|
552 | 546 | if isinstance(i, bytes): |
|
553 | 547 | yield i |
|
554 | 548 | elif i is None: |
General Comments 0
You need to be logged in to leave comments.
Login now