def populate_datastore_choices(self, request, context):
    choices = ()
    set_initial = False
    datastores = self.datastores(request)
    if (datastores is not None):
        num_datastores_with_one_version = 0
        for ds in datastores:
            versions = self.datastore_versions(request, ds.name)
            if (not set_initial):
                if (len(versions) >= 2):
                    set_initial = True
                elif (len(versions) == 1):
                    num_datastores_with_one_version += 1
                    if (num_datastores_with_one_version > 1):
                        set_initial = True
            if versions:
                version_choices = ()
                for v in versions:
                    version_choices = (version_choices + ((((ds.name + ',') + v.name), v.name),))
                datastore_choices = (ds.name, version_choices)
                choices = (choices + (datastore_choices,))
        if set_initial:
            initial = ('select_datastore_type_version', _('Select datastore type and version'))
            choices = ((initial,) + choices)
    return choices
def populate_datastore_choices(self, request, context):
    choices = ()
    set_initial = False
    datastores = self.datastores(request)
    if (datastores is not None):
        num_datastores_with_one_version = 0
        for ds in datastores:
            versions = self.datastore_versions(request, ds.name)
            if (not set_initial):
                if (len(versions) >= 2):
                    set_initial = True
                elif (len(versions) == 1):
                    num_datastores_with_one_version += 1
                    if (num_datastores_with_one_version > 1):
                        set_initial = True
            if versions:
                version_choices = ()
                for v in versions:
                    version_choices = (version_choices + ((((ds.name + ',') + v.name), v.name),))
                datastore_choices = (ds.name, version_choices)
                choices = (choices + (datastore_choices,))
        if set_initial:
            initial = ('select_datastore_type_version', _('Select datastore type and version'))
            choices = ((initial,) + choices)
    return choices