didn't we try that with gluino and - basically - didn't receive any attention from the community ?!
as for the "steps" ....
- integrate in DAL code the modules you have in contrib (ordered ditct and some adapters)
not a problem
- integrate validators in DAL code or make it possible to pass validators to DAL when inited or via subclassing
validators have a pretty specific machinery to let them work with forms, rendering, widgets, etc. I'm +1 on rationalizing "allow this field to be an integer from 0 to 10" but it'll be hard to do it maintaining backward compatibility AND requiring any framework using DAL to provide a full set of their own validators....
- allow the possibility to use custom serializers, avoid expectance of the web2py's ones
not an issue too, but AFAIK there are some pretty specific serialization gotchas that will basically lock down the implementation to what is already in there
- not raising HTTP exceptions but custom ones, so other projects can catch them as they prefer
see "validators"
def retrieve(self, name, path=None, nameonly=False):
"""
If `nameonly==True` return (filename, fullfilename) instead of
(filename, stream)
"""
self_uploadfield = self.uploadfield
if self.custom_retrieve:
return self.custom_retrieve(name, path)
import gluon.http as http
if self.authorize or isinstance(self_uploadfield, str):
row = self.db(self == name).select().first()
if not row:
raise http.HTTP(404)
if self.authorize and not self.authorize(row):
raise http.HTTP(403)
- move out of DAL the rendering with sqlhtml or allow to use custom render functions
see "validators"
def render(self, i=None, fields=None):
"""
Takes an index and returns a copy of the indexed row with values
transformed via the "represent" attributes of the associated fields.
Args:
i: index. If not specified, a generator is returned for iteration
over all the rows.
fields: a list of fields to transform (if None, all fields with
"represent" attributes will be transformed)
"""
if i is None:
return (self.render(i, fields=fields) for i in range(len(self)))
import gluon.sqlhtml as sqlhtml
row = copy.deepcopy(self.records[i])
keys = row.keys()
tables = [f.tablename for f in fields] if fields \
else [k for k in keys if k != '_extra']
for table in tables:
repr_fields = [f.name for f in fields if f.tablename == table] \
if fields else [k for k in row[table].keys()
if (hasattr(self.db[table], k) and
isinstance(self.db[table][k], Field)
and self.db[table][k].represent)]
for field in repr_fields:
row[table][field] = sqlhtml.represent(
self.db[table][field], row[table][field], row[table])
if self.compact and len(keys) == 1 and keys[0] != '_extra':
return row[keys[0]]
return row
def xml(self,strict=False,row_name='row',rows_name='rows'):
"""
Serializes the table using sqlhtml.SQLTABLE (if present)
"""
if strict:
return '<%s>\n%s\n</%s>' % (rows_name,
'\n'.join(row.as_xml(row_name=row_name,
colnames=self.colnames) for
row in self), rows_name)
import gluon.sqlhtml as sqlhtml
return sqlhtml.SQLTABLE(self).xml()
- move testing inside DAL
last of the problems: test suites are already pretty isolated
Can you make a repository for the DAL where the first commit is the unmodified DAL and the second is your changes so it's easier to see what we would need to change in web2py?
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Massimo,
As we said before, I think you should base the repo from the original web2py one, to keep the original commit history and contributors. Basically this will make the job:
1) delete current DAL repo
2) clone the current web2py master
3) change the cloned repo origin to the DAL one
4) create a commit where you delete everything but DAL, move to the upper level and add readme
5) push this to the DAL origin
/Giovanni
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/ch6ZRfW0AVk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.
PS: if this would be a pip package I suggest to name it pydal ;-)
Flying today. Will process later or tomorrow.
Please, make the PR on pydal repo so we can merge it directly.
/Giovanni
@giovanni: made this PR https://github.com/web2py/web2py/pull/566 .... make sure it gets in on pydal before merging/submoduling/etc please
BTW2: how will this affect the googlecode repo ? I was one of the first stating that github should be "the one and only" but kept getting "we'll maintain googlecode as "backup"" ... there are a few scripts around pointing to googlecode that will need to be adapted if googlecode gets shut down, and frankly I don't see how it can be maintained easily in sync with github and the new structure.........
I agree on the "github move", I don't see any trouble about maintaining a googlecode backup, as we can update it just when we do a new release, we just need to update the scripts.
I‘d write more tests
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
--
nothing is stopping us but I'm just raising "concern points" on the overall results.
before merging there are always some things to consider, and now is the time to do it.
What I don't like of the "current" status on the merge:
- no coverage
- no docs
- weird folder structure for contribs
- test separation ('cause pydal won't ever be able to run tests depending on something related to web2py strictly, e.g. validate_and_insert() tests)
coverage and docs are merely implementation issues....
weird folder structure and test separation needs a "clear path" to follow before going further on with the implementation.
Having
gluon
contrib
pydal
pydal
contrib
is a PITA. Nothing will make me consider this as a "sane" scheme, a) for the "double" pydal folder and b) for the two "contrib" folder.
As for the "rules" of modules in contribs (web2py-side) the point was to make available any pure-python driver module available because of the "batteries included" nature of web2py.
Now, if pyDAL wants to follow the same "batteries included" mode, we should avoid having drivers in two places: if instead pyDAL remains a module who can optionally use compatible drivers installed on the system, it'll be more of a python module like any others, with a fixed number of - optional - dependencies (and, to be fair, I'd prefer it).
At that point, though, the imports at the top would have to be rewritten to use the available system-wide modules (to use pyDAL as a standalone package) and web2py would have to use system-wide modules before the ones in web2py-contrib. Don't know about the reliability of such system.
--
Ok, let's wait for pydal integration.
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/ch6ZRfW0AVk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.
I mean, the actual merge scheme is "awful", yes.But actually I can't see any main reason to consider it as a PITA. My reasons are:1) the meaning of having a 'contrib' folder is actually to store in it external modules/packages/features which are not involved into web2py "main development". I can object with the same logic that I don't like to see modules in that folder that have a dedicated 'tests' folder, because can make confusion with the gluon/tests folder. But as I said, here we have "external" modules, so why a module cannot have its own tests/docs/libraries?2) users' side: I'm quite sure a web2py user doesn't care about "contrib" folder substructure3) developers' side: the actual implementation via a git-submodule is actually very "clear" to a developer, as it points DIRECTLY to the pydal repository, meaning that if I'm a developer I can understand on what I'm working on in a snap. Moreover, the git sub-module allow web2py to track a particular release of pyDAL. Which means you can release web2py 2.10.x with pydal 1.x and web2py 2.10.y with pydal 1.y simply running "git pull" and "git checkout v1.y" inside the contrib/pydal folder.
Well that's actually a consequence of using a submodule. A git submodule is basically an inclusion of a repository into another one using a folder.
The "duplication" of the "pydal" directory comes from the fact I named "pydal" the folder into I linked the repository, and the pydal is structured with a "package design" so the code is under a "pydal" directory.
The main issue here is that web2py has the "zero setup" design, so we cannot use pypi to use pydal.
Considering the purpose of the 2 projects, and to avoid code duplication, I think a submodule is the best solution we have. Even using a git subtree will cause a code duplication and, consequentially, an harder management of the development flow.
I'm actually out of ideas on how to better design the structure of the inclusion.
If it's just a naming factor, we can do something like that:
gluon
Packages
Dal -> repository
Pydal -> repository pydal folder
But I think is only a "masquerading" thing..
/Giovanni
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/ch6ZRfW0AVk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.