Esempio n. 1
0
def embeddable_sr(thing):
    if isinstance(thing, Subreddit):
        sr = thing
    else:
        try:
            sr = Subreddit._byID(thing.sr_id) if thing.sr_id else None
        except NotFound:
            sr = None

    return sr if (sr is not None and sr.type not in Subreddit.private_types) else False
Esempio n. 2
0
def embeddable_sr(thing):
    if isinstance(thing, Subreddit):
        sr = thing
    else:
        try:
            sr = Subreddit._byID(thing.sr_id) if thing.sr_id else None
        except NotFound:
            sr = None

    return sr if (sr is not None
                  and sr.type not in DISALLOWED_SR_TYPES) else False
Esempio n. 3
0
def embeddable_sr(thing):
    if isinstance(thing, Subreddit):
        sr = thing
    else:
        try:
            sr = Subreddit._byID(thing.sr_id,
                                 data=True) if thing.sr_id else None
        except NotFound:
            sr = None

    return sr if (sr is not None
                  and sr.type not in Subreddit.private_types) else False
Esempio n. 4
0
def embeddable_sr(thing):
    if isinstance(thing, Subreddit):
        sr = thing
    else:
        try:
            sr = Subreddit._byID(thing.sr_id, data=True) if thing.sr_id else None
        except NotFound:
            sr = None

    if (sr is not None and
            sr.type not in Subreddit.private_types and
            not sr.quarantine):
        return sr
    else:
        return False