Example #1
0
def _make_post(content):
    try:
        return base.Post(
            raw_content=content.text,
            guid=str(content.guid),
            handle=content.author.handle,
            public=True,
            provider_display_name="Socialhome",
            created_at=content.effective_created,
        )
    except Exception as ex:
        logger.exception("_make_post - Failed to convert %s: %s", content.guid,
                         ex)
        return None
Example #2
0
def _make_post(content: Content) -> Optional[base.Post]:
    try:
        return base.Post(
            raw_content=content.text,
            id=content.fid,
            actor_id=content.author.fid,
            public=True if content.visibility == Visibility.PUBLIC else False,
            provider_display_name="Socialhome",
            created_at=content.effective_modified,
            guid=str(content.uuid),
            handle=content.author.handle,
        )
    except Exception as ex:
        logger.exception("_make_post - Failed to convert %s: %s", content.fid,
                         ex)
Example #3
0
def make_federable_entity(content):
    """Make Content federable by converting it to a federation entity."""
    logging.info("make_federable_entity - Content: %s" % content)
    try:
        return base.Post(
            raw_content=content.text,
            guid=str(content.guid),
            handle=content.author.handle,
            public=True,
            provider_display_name="Socialhome",
            created_at=content.effective_created,
        )
    except Exception as ex:
        logger.exception("make_federable_entity - Failed to convert %s: %s",
                         content.guid, ex)
        return None