45
45
from zope.security.proxy import removeSecurityProxy
46
46
from zope.testbrowser.testing import Browser
48
from canonical.launchpad.interfaces import (
49
ILaunchpadCelebrities,
48
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
49
from canonical.launchpad.interfaces.oauth import (
54
53
from canonical.launchpad.testing.systemdocs import (
55
54
LayeredDocFileSuite,
62
61
from canonical.launchpad.webapp.url import urlsplit
63
62
from canonical.testing.layers import PageTestLayer
64
63
from lp.registry.errors import NameAlreadyTaken
64
from lp.registry.interfaces.teammembership import TeamMembershipStatus
65
65
from lp.testing import (
319
319
print sep.join(row_content)
322
def print_radio_button_field(content, name):
323
"""Find the input called field.name, and print a friendly representation.
322
def get_radio_button_text_for_field(soup, name):
323
"""Find the input called field.name, and return an iterable of strings.
325
325
The resulting output will look something like:
327
( ) An unchecked option
326
['(*) A checked option', '( ) An unchecked option']
329
main = BeautifulSoup(content)
330
buttons = main.findAll(
328
buttons = soup.findAll(
331
329
'input', {'name': 'field.%s' % name})
332
330
for button in buttons:
333
331
if button.parent.name == 'label':
334
332
label = extract_text(button.parent)
336
334
label = extract_text(
337
main.find('label', attrs={'for': button['id']}))
335
soup.find('label', attrs={'for': button['id']}))
338
336
if button.get('checked', None):
340
yield "%s %s" % (radio, label)
343
def print_radio_button_field(content, name):
344
"""Find the input called field.name, and print a friendly representation.
346
The resulting output will look something like:
348
( ) An unchecked option
350
main = BeautifulSoup(content)
351
for field in get_radio_button_text_for_field(main, name):
345
355
def strip_label(label):