Did I find the right examples for you? yes no

All Samples(22)  |  Call(18)  |  Derive(0)  |  Import(4)

src/w/s/WSME-0.6/examples/demo/demo.py   WSME(Download)
 
from wsme import WSRoot, expose, validate
from wsme.types import File
 
import bottle

src/w/s/wsme-HEAD/examples/demo/demo.py   wsme(Download)
 
from wsme import WSRoot, expose, validate
from wsme.types import File
 
import bottle

src/w/s/WSME-0.6/wsme/rest/args.py   WSME(Download)
 
from wsme.types import iscomplex, list_attributes, Unset
from wsme.types import UserType, ArrayType, DictType, File
from wsme.utils import parse_isodate, parse_isotime, parse_isodatetime
import wsme.runtime
def filetype_from_param(datatype, value):
    if isinstance(value, cgi.FieldStorage):
        return File(fieldstorage=value)
    return File(content=value)
 

src/w/s/wsme-HEAD/wsme/rest/args.py   wsme(Download)
 
from wsme.types import iscomplex, list_attributes, Unset
from wsme.types import UserType, ArrayType, DictType, File
from wsme.utils import parse_isodate, parse_isotime, parse_isodatetime
import wsme.runtime
def filetype_from_param(datatype, value):
    if isinstance(value, cgi.FieldStorage):
        return File(fieldstorage=value)
    return File(content=value)
 

src/w/s/WSME-0.6/wsme/tests/test_types.py   WSME(Download)
    def test_file_get_content_by_reading(self):
        class buffer:
            def read(self):
                return 'abcdef'
        f = types.File(file=buffer())
    def test_file_content_overrides_file(self):
        class buffer:
            def read(self):
                return 'from-file'
        f = types.File(content='from-content', file=buffer())
    def test_file_setting_content_discards_file(self):
        class buffer:
            def read(self):
                return 'from-file'
        f = types.File(file=buffer())
            file = buffer()
            type = 'application/json'
        f = types.File(fieldstorage=fieldstorage)
        assert f.content == 'from-file'
 
            type = 'application/json'
            value = 'from-value'
        f = types.File(fieldstorage=fieldstorage)
        assert f.content == 'from-value'
 

src/w/s/wsme-HEAD/wsme/tests/test_types.py   wsme(Download)
    def test_file_get_content_by_reading(self):
        class buffer:
            def read(self):
                return 'abcdef'
        f = types.File(file=buffer())
    def test_file_content_overrides_file(self):
        class buffer:
            def read(self):
                return 'from-file'
        f = types.File(content='from-content', file=buffer())
    def test_file_setting_content_discards_file(self):
        class buffer:
            def read(self):
                return 'from-file'
        f = types.File(file=buffer())
            file = buffer()
            type = 'application/json'
        f = types.File(fieldstorage=fieldstorage)
        assert f.content == 'from-file'
 
            type = 'application/json'
            value = 'from-value'
        f = types.File(fieldstorage=fieldstorage)
        assert f.content == 'from-value'