5. In dal.py:

class NoSQLAdapter(BaseAdapter):

    def represent(self, obj, fieldtype):
        if type(obj) in (types.LambdaType, types.FunctionType):
            obj = obj()
        if isinstance(fieldtype, SQLCustomType):
            return fieldtype.encoder(obj)
        if isinstance(obj, (Expression, Field)):
            raise SyntaxError, "non supported on GAE"

        if 'gae' in globals():
            if isinstance(fieldtype, gae.Property):
                return obj

        if fieldtype.startswith('list:'):  # dlypka patch to move this
to be AFTER the if 'gae' clause because fieldtype may not necessarily
be a string
            if not obj:
                obj = []
            if not isinstance(obj, (list, tuple)):
                obj = [obj]


On Feb 5, 11:21 am, dlypka <[email protected]> wrote:
> More issues
> 1. # dlypka Mod in dal.py: had to move this try .. except up here in
> front of class NoSQLAdapter because gae is needed in class
> NoSQLAdapter
> try:
>     from new import classobj
>     from google.appengine.ext import db as gae
>     from google.appengine.api import namespace_manager
>     # from google.appengine.api.datastore_types import Key  ### why
> was this needed????
>     from google.appengine.ext.db.polymodel import PolyModel
>     drivers.append('gae')
> except ImportError:
>     pass
>
> class NoSQLAdapter(BaseAdapter):
>
> 2. html.py line 265
>     return rewrite.filter_out(url, env) # dlypka patch. Was
> XML(rewrite.filter_out(url, env))
> # XML() causes Exception:
> #   File "C:\Program Files (x86)\Google\google_appengine\google
> \appengine\api\datastore_types.py", line 1323, in ValidateProperty
> #    'Unsupported type for property %s: %s' % (name, v.__class__))
> #       BadValueError: Unsupported type for property success_path:
> <class 'gluon.html.XML'>
>
> 3. class GAENoSQLAdapter(NoSQLAdapter):
>     uploads_in_blob = True
>     types = {}
>
>     def file_exists(self, filename): pass
>     def file_open(self, filename, mode='rb', lock=True): pass
>     def file_close(self, fileobj, unlock=True): pass
>
>     def __init__(self,db,uri,pool_size=0,folder=None,db_codec
> ='UTF-8',
>                  credential_decoder=(lambda x:x)):  # dlypka patch:
> added brackets around lambda - syntax error
>         self.types.update({
>
> 4.     def insert(self,table,fields):
>         dfields=dict((f.name,self.represent(v,f.type)) for f,v in
> fields)
>         # table._db['_lastsql'] = self._insert(table,fields)
>         tmp = table._tableobj(**dfields)
>         tmp.put()
>         table._db['_last_reference'] = tmp # dlypka patched based on
> June 27/2010 mod in the trunk
>         rid = Reference(tmp.key().id())
>         (rid._table, rid._record) = (table, None)
>         return rid

Reply via email to