How to use the ming.schema.String function in Ming

To help you get started, we’ve selected a few Ming examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TurboGears / Ming / benchmarks / validation.py View on Github external
source=Field(str)
    sf_id=Field(int)
    projecttype=Field(int)
    private=Field(S.Bool(if_missing=False))
    name=Field(str)
    summary=Field(StringNotNone)
    created=Field(datetime)
    description=Field(StringNotNone)
    doap=Field(str)
    project_url=Field(str)
    homepage=Field(str)
    updated=Field(S.Deprecated)
    _last_changed=Field('last_changed', datetime)
    ad_keywords=Field([[str]]) # ['ohl', 'ad20848'] would translate to "ohl=ad20848;" in JS
    download_info=Field(S.Deprecated)
    _icon_url=Field('icon_url', S.String(if_missing=S.Missing)) # for backward compat.
    _features=Field('features', S.Array(str, if_missing=S.Missing)) # for backward compat.
    reviews_disabled=Field(bool)
    relations_data=Field(S.Object(dict(
        is_admin=S.Deprecated,
        rating=float,
        code=int,
        review_count=int,
        features=[str],
        tags=[dict(count=int, tag=str, approved=bool)],
        icon_url=str,
        latest_reviews=[_review],
        name=str,
        reviews=[_review],
        text=str), if_missing=None))
    related=Field([dict(source=None, shortname=None, name=str, description=str,
                        screenshots=[_screenshot], ok_to_recommend=bool,
github apache / allura / Allura / allura / model / types.py View on Github external
def __init__(self, **kw):
        super(MarkdownCache, self).__init__(
            fields=dict(
                md5=S.String(),
                fix7528=S.Anything,
                html=S.String(),
                render_time=S.Float()),
            **kw)
github apache / allura / Allura / allura / model / types.py View on Github external
def __init__(self, permissions, **kwargs):
        if permissions is None:
            permission = S.String()
        else:
            permission = S.OneOf('*', *permissions)
        super(ACE, self).__init__(
            fields=dict(
                access=S.OneOf(self.ALLOW, self.DENY),
                reason=S.String(),
                role_id=S.ObjectId(),
                permission=permission),
            **kwargs)
github apache / allura / ForgeDiscussion / forgediscussion / import_support.py View on Github external
def _validate(self, value, **kw):
        value = S.String().validate(value)
        sf_username = self.mapping.get(value, value)
        result = M.User.by_username(sf_username)
        if result is None:
            self.warnings.append('User %s not found' % value)
            if callable(self.default_username):
                sf_username = self.default_username(value)
            else:
                sf_username = self.default_username
            self.warnings.append('... setting username to %r' % sf_username)
            result = M.User.by_username(sf_username)
            self.mapping[value] = sf_username
        return result
github apache / allura / Allura / allura / model / types.py View on Github external
def __init__(self):
        self._base_schema = S.Object(dict(
                project_id=S.ObjectId(if_missing=self.default_project_id),
                mount_point=S.String(if_missing=self.default_mount_point),
                artifact_type=S.Binary, # pickled class
                artifact_id=S.Anything(if_missing=None)))
github rick446 / MongoPyChef / mongopychef / model / m_base.py View on Github external
def __init__(self):
        super(CookbookFile, self).__init__(
            fields=dict(
                name=S.String(),
                url=S.String(),
                checksum=S.String(),
                path=S.String(),
                specificity=S.String()))
github davidfischer-ch / pytoolbox / pytoolbox / ming / schema.py View on Github external
def __init__(self, url_friendly, **kwargs):
        self.url_friendly = url_friendly
        String.__init__(self, **kwargs)
github apache / allura / Allura / allura / model / types.py View on Github external
def __init__(self, **kw):
        super(MarkdownCache, self).__init__(
            fields=dict(
                md5=S.String(),
                fix7528=S.Anything,
                html=S.String(),
                render_time=S.Float()),
            **kw)