Esempio n. 1
0
class IMultiPolygon(ISimple):

    """Geo location MultiPolygon.

    Polygons can store a large list of geo location points.
    To allow long term caching it cannot be modified after creation.
    """

    # TODO add cache for ever cache strategy


multipolygon_meta = simple_meta._replace(
    iresource=IMultiPolygon,
    permission_create='create_multipolygon',
    is_implicit_addable=False,
    extended_sheets=(
        adhocracy_core.sheets.geo.IMultiPolygon,
    ),
)


class ILocationsService(IServicePool):

    """The 'locations' ServicePool."""


locations_service_meta = service_meta._replace(
    iresource=ILocationsService,
    content_name='locations',
    element_types=[
        IMultiPolygon,
Esempio n. 2
0
from adhocracy_core.resources.service import service_meta


class IMultiPolygon(ISimple):
    """Geo location MultiPolygon.

    Polygons can store a large list of geo location points.
    To allow long term caching it cannot be modified after creation.
    """

    # TODO add cache for ever cache strategy


multipolygon_meta = simple_meta._replace(
    iresource=IMultiPolygon,
    permission_create='create_multipolygon',
    is_implicit_addable=False,
    extended_sheets=(adhocracy_core.sheets.geo.IMultiPolygon, ),
)


class ILocationsService(IServicePool):
    """The 'locations' ServicePool."""


locations_service_meta = service_meta._replace(
    iresource=ILocationsService,
    content_name='locations',
    element_types=[
        IMultiPolygon,
    ],
)
Esempio n. 3
0
from adhocracy_core.utils import get_matching_isheet
from adhocracy_core.utils import get_sheet
from adhocracy_core.utils import raise_colander_style_error
import adhocracy_core.sheets.metadata
import adhocracy_core.sheets.asset
import adhocracy_core.sheets.title


class IAssetDownload(ISimple):

    """Downloadable binary file for Assets."""


asset_download_meta = simple_meta._replace(
    content_name='AssetDownload',
    iresource=IAssetDownload,
    basic_sheets=(IName, IAssetData),
)


class IAsset(ISimple):

    """A generic asset (binary file)."""


def validate_and_complete_asset(context: IAsset,
                                registry: Registry,
                                options: dict={}):
    """Complete the initialization of an asset and ensure that it's valid."""
    data_sheet = get_sheet(context, IAssetData, registry=registry)
    data_appstruct = data_sheet.get()
Esempio n. 4
0
from adhocracy_core.resources.pool import pool_meta
import adhocracy_core.sheets.badge
import adhocracy_core.sheets.description
import adhocracy_core.sheets.metadata
import adhocracy_core.sheets.name
import adhocracy_core.sheets.title


class IBadge(ISimple):

    """A generic badge."""


badge_meta = simple_meta._replace(
    iresource=IBadge,
    extended_sheets=(adhocracy_core.sheets.description.IDescription, adhocracy_core.sheets.badge.IBadge),
    permission_create="create_badge",
)


class IBadgeGroup(IPool):

    """A generic badge group pool."""


badge_group_meta = pool_meta._replace(
    iresource=IBadgeGroup,
    extended_sheets=(adhocracy_core.sheets.description.IDescription,),
    permission_create="create_badge_group",
    element_types=(IBadge, IBadgeGroup),
)
Esempio n. 5
0
from adhocracy_core.resources.badge import add_badge_assignments_service

import adhocracy_mercator.sheets.mercator2
import adhocracy_core.sheets


class IPitch(ISimple):
    """Proposal's pitch."""


pitch_meta = simple_meta._replace(
    content_name='Pitch',
    iresource=IPitch,
    permission_create='edit',
    use_autonaming=True,
    autonaming_prefix='pitch',
    extended_sheets=(
        adhocracy_mercator.sheets.mercator2.IPitch,
        adhocracy_core.sheets.description.IDescription,
        adhocracy_core.sheets.comment.ICommentable),
)


class IPartners(ISimple):
    """Proposal's partners."""


partners_meta = simple_meta._replace(
    content_name='Partners',
    iresource=IPartners,
    permission_create='edit',
Esempio n. 6
0
from adhocracy_core.resources.rate import add_ratesservice
from adhocracy_core.resources.badge import add_badge_assignments_service

import adhocracy_mercator.sheets.mercator2
import adhocracy_core.sheets


class IPitch(ISimple):
    """Proposal's pitch."""


pitch_meta = simple_meta._replace(
    content_name='Pitch',
    iresource=IPitch,
    permission_create='edit',
    use_autonaming=True,
    autonaming_prefix='pitch',
    extended_sheets=(adhocracy_mercator.sheets.mercator2.IPitch,
                     adhocracy_core.sheets.description.IDescription,
                     adhocracy_core.sheets.comment.ICommentable),
)


class IPartners(ISimple):
    """Proposal's partners."""


partners_meta = simple_meta._replace(
    content_name='Partners',
    iresource=IPartners,
    permission_create='edit',
    use_autonaming=True,
Esempio n. 7
0
import adhocracy_core.sheets.badge
import adhocracy_core.sheets.description
import adhocracy_core.sheets.metadata
import adhocracy_core.sheets.name
import adhocracy_core.sheets.title


class IBadge(ISimple):

    """A generic badge."""


badge_meta = simple_meta._replace(
    iresource=IBadge,
    extended_sheets=(
        adhocracy_core.sheets.description.IDescription,
        adhocracy_core.sheets.badge.IBadge,
    ),
    permission_create='create_badge',
)


class IBadgeGroup(IPool):

    """A generic badge group pool."""


badge_group_meta = pool_meta._replace(
    iresource=IBadgeGroup,
    extended_sheets=(
        adhocracy_core.sheets.description.IDescription,
    ),
Esempio n. 8
0
import adhocracy_core.sheets.description
import adhocracy_core.sheets.metadata
import adhocracy_core.sheets.name
import adhocracy_core.sheets.title


class IBadge(ISimple):
    """A generic badge."""


badge_meta = simple_meta._replace(
    iresource=IBadge,
    use_autonaming=False,
    extended_sheets=(
        adhocracy_core.sheets.description.IDescription,
        adhocracy_core.sheets.badge.IBadge,
    ),
    permission_create='create_badge',
)._add(
    extended_sheets=(adhocracy_core.sheets.name.IName,)
)


class IBadgeGroup(IPool):
    """A generic badge group pool."""


badge_group_meta = pool_meta._replace(
    iresource=IBadgeGroup,
    extended_sheets=(
        adhocracy_core.sheets.description.IDescription,
Esempio n. 9
0
from adhocracy_core.resources.service import service_meta

import adhocracy_core.sheets


class IPage(ISimple):
    """A simple page."""


page_meta = simple_meta._replace(
    content_name='Page',
    iresource=IPage,
    use_autonaming=False,
    basic_sheets=(adhocracy_core.sheets.name.IName,
                  adhocracy_core.sheets.title.ITitle,
                  adhocracy_core.sheets.description.IDescription,
                  adhocracy_core.sheets.metadata.IMetadata,
                  ),
    permission_create='create_page',
    is_sdi_addable=True,

)


class IPageService(IServicePool):
    """The 'page' ServicePool."""


page_service_meta = service_meta._replace(
    iresource=IPageService,
    content_name='pages',
Esempio n. 10
0
from adhocracy_core.sheets.name import IName
from adhocracy_core.utils import get_matching_isheet
from adhocracy_core.utils import get_sheet
from adhocracy_core.utils import raise_colander_style_error
import adhocracy_core.sheets.metadata
import adhocracy_core.sheets.asset
import adhocracy_core.sheets.title


class IAssetDownload(ISimple):
    """Downloadable binary file for Assets."""


asset_download_meta = simple_meta._replace(
    content_name='AssetDownload',
    iresource=IAssetDownload,
    basic_sheets=(IName, IAssetData),
)


class IAsset(ISimple):
    """A generic asset (binary file)."""


def validate_and_complete_asset(context: IAsset,
                                registry: Registry,
                                options: dict = {}):
    """Complete the initialization of an asset and ensure that it's valid."""
    data_sheet = get_sheet(context, IAssetData, registry=registry)
    data_appstruct = data_sheet.get()
    metadata_isheet = get_matching_isheet(context, IAssetMetadata)
Esempio n. 11
0
from adhocracy_core.resources.service import service_meta

import adhocracy_core.sheets


class IPage(ISimple):
    """A simple page."""


page_meta = simple_meta._replace(
    content_name='Page',
    iresource=IPage,
    use_autonaming=False,
    basic_sheets=(
        adhocracy_core.sheets.name.IName,
        adhocracy_core.sheets.title.ITitle,
        adhocracy_core.sheets.description.IDescription,
        adhocracy_core.sheets.metadata.IMetadata,
    ),
    permission_create='create_page',
    is_sdi_addable=True,
)


class IPageService(IServicePool):
    """The 'page' ServicePool."""


page_service_meta = service_meta._replace(
    iresource=IPageService,
    content_name='pages',
Esempio n. 12
0
from adhocracy_core.resources import add_resource_type_to_registry
from adhocracy_core.resources.simple import simple_meta
from adhocracy_core.resources.service import service_meta
import adhocracy_core.sheets.activity
import adhocracy_core.sheets.metadata


class IActivity(ISimple):
    """An activity stream entry."""


activity_meta = simple_meta._replace(
    content_name='Activity',
    iresource=IActivity,
    permission_create='create_activity',
    autonaming_prefix='activity',
    basic_sheets=(
        adhocracy_core.sheets.metadata.IMetadata,
        adhocracy_core.sheets.activity.IActivity,
    ),
)


class IActivityService(IServicePool):
    """The 'activity' ServicePool."""


activity_service_meta = service_meta._replace(
    iresource=IActivityService,
    content_name='activity_stream',
    element_types=(IActivity, ),
)
Esempio n. 13
0
from adhocracy_core.interfaces import IServicePool
from adhocracy_core.resources import add_resource_type_to_registry
from adhocracy_core.resources.simple import simple_meta
from adhocracy_core.resources.service import service_meta
import adhocracy_core.sheets.activity
import adhocracy_core.sheets.metadata


class IActivity(ISimple):
    """An activity stream entry."""

activity_meta = simple_meta._replace(
    content_name='Activity',
    iresource=IActivity,
    permission_create='create_activity',
    autonaming_prefix='activity',
    basic_sheets=(adhocracy_core.sheets.metadata.IMetadata,
                  adhocracy_core.sheets.activity.IActivity,
                  ),
)


class IActivityService(IServicePool):
    """The 'activity' ServicePool."""


activity_service_meta = service_meta._replace(
    iresource=IActivityService,
    content_name='activity_stream',
    element_types=(IActivity,),
)
Esempio n. 14
0
class IMultiPolygon(ISimple):
    """Geo location MultiPolygon.

    Polygons can store a large list of geo location points.
    To allow long term caching it cannot be modified after creation.
    """

    # TODO add cache for ever cache strategy


multipolygon_meta = simple_meta._replace(
    iresource=IMultiPolygon,
    permission_create='create_multipolygon',
    use_autonaming=False,
    is_implicit_addable=False,
    extended_sheets=(
        adhocracy_core.sheets.name.IName,
        adhocracy_core.sheets.geo.IMultiPolygon,
    ),
    is_sdi_addable=True,
)


class ILocationsService(IServicePool):
    """The 'locations' ServicePool."""


locations_service_meta = service_meta._replace(
    iresource=ILocationsService,
    content_name='locations',
    element_types=[