# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1242298091 -7200 # Node ID aa09e20dd8c02f3a22c72561cf800bf4474eaa95 # Parent 49075f57cf2c4825d886fafb818ac7e0efcc428c# Parent 6d541c610165a070167c37542d83a2b541ae338b backport tls-sprint diff -r 6d541c610165 -r aa09e20dd8c0 common/appobject.py diff -r 6d541c610165 -r aa09e20dd8c0 common/utils.py diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/annexes/cookbook.rst --- a/doc/book/en/annexes/cookbook.rst Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/annexes/cookbook.rst Thu May 14 12:48:11 2009 +0200 @@ -62,3 +62,19 @@ cnx.commit() cnx.close() + +* How to load data from a script? + + The following script aims at loading data within a script assuming pyro-nsd is + running and your application is configured with ``pyro-server=yes``, otherwise + you would not be able to use dbapi. :: + + from cubicweb import dbapi + + cnx = dbapi.connection(database='instance-id', user='admin', password='admin') + cur = cnx.cursor() + for name in ('Personal', 'Professional', 'Computers'): + cur.execute('INSERT Blog B: B name %s', name) + cnx.commit() + + diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/annexes/faq.rst --- a/doc/book/en/annexes/faq.rst Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/annexes/faq.rst Thu May 14 12:48:11 2009 +0200 @@ -69,8 +69,13 @@ one schema to the other ever since. There is a well-defined way to handle data and schema migration. +<<<<<<< /home/syt/src/fcubicweb/cubicweb_3.2/doc/book/en/annexes/faq.rst +Why is the RQL query language looking similar to X ? +---------------------------------------------------- +======= Why is the RQL query language looking similar to X ? ----------------------------------------------------- +>>>>>>> /tmp/faq.rst~other.MxOUAP It may remind you of SQL but it is higher level than SQL, more like SPARQL. Except that SPARQL did not exist when we started the project. @@ -96,7 +101,46 @@ which ajax library ------------------ - [we use jquery and things on top of that] +[we use jquery and things on top of that] + + +How to implement security? +-------------------------- + + This is an example of how it works in our framework:: + + class Version(EntityType): + """a version is defining the content of a particular project's + release""" + # definition of attributes is voluntarily missing + permissions = {'read': ('managers', 'users', 'guests',), + 'update': ('managers', 'logilab', 'owners',), + 'delete': ('managers', ), + 'add': ('managers', 'logilab', + ERQLExpression('X version_of PROJ, U in_group G, PROJ + require_permission P, P name "add_version", P require_group G'),)} + + The above means that permission to read a Version is granted to any + user that is part of one of the groups 'managers', 'users', 'guests'. + The 'add' permission is granted to users in group 'managers' or + 'logilab' and to users in group G, if G is linked by a permission + entity named "add_version" to the version's project. + :: + + class version_of(RelationType): + """link a version to its project. A version is necessarily linked + to one and only one project. """ + # some lines voluntarily missing + permissions = {'read': ('managers', 'users', 'guests',), + 'delete': ('managers', ), + 'add': ('managers', 'logilab', + RRQLExpression('O require_permission P, P name "add_version", + 'U in_group G, P require_group G'),) } + + You can find additional information in the section :ref:`security`. + + [XXX what does the second example means in addition to the first one?] + `Error while publishing rest text ...` -------------------------------------- @@ -204,6 +248,7 @@ where DATADIR is ``mycubes/data``. + How to configure LDAP source? ------------------------------- @@ -297,41 +342,3 @@ [XXX check that cw handle users better by mapping Google Accounts to local Euser entities automatically] - -How to implement security? --------------------------- - - This is an example of how it works in our framework:: - - class Version(EntityType): - """a version is defining the content of a particular project's - release""" - # definition of attributes is voluntarily missing - permissions = {'read': ('managers', 'users', 'guests',), - 'update': ('managers', 'logilab', 'owners',), - 'delete': ('managers', ), - 'add': ('managers', 'logilab', - ERQLExpression('X version_of PROJ, U in_group G, PROJ - require_permission P, P name "add_version", P require_group G'),)} - - The above means that permission to read a Version is granted to any - user that is part of one of the groups 'managers', 'users', 'guests'. - The 'add' permission is granted to users in group 'managers' or - 'logilab' and to users in group G, if G is linked by a permission - entity named "add_version" to the version's project. - :: - - class version_of(RelationType): - """link a version to its project. A version is necessarily linked - to one and only one project. """ - # some lines voluntarily missing - permissions = {'read': ('managers', 'users', 'guests',), - 'delete': ('managers', ), - 'add': ('managers', 'logilab', - RRQLExpression('O require_permission P, P name "add_version", - 'U in_group G, P require_group G'),) } - - You can find additional information in the section :ref:`security`. - - [XXX what does the second example means in addition to the first one?] - diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/conf.py --- a/doc/book/en/conf.py Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/conf.py Thu May 14 12:48:11 2009 +0200 @@ -53,7 +53,7 @@ today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. -#unused_docs = [] +unused_docs = ['D070-modules-cbw-api.en',] # List of directories, relative to source directories, that shouldn't be searched # for source files. diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/index.rst --- a/doc/book/en/index.rst Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/index.rst Thu May 14 12:48:11 2009 +0200 @@ -29,8 +29,6 @@ The hacker will join development at the forge_. -The impatient will go strait away to :ref:`QuickInstall`. - The impatient developper will move right away to :ref:`SetUpEnv`. .. _Logilab: http://www.logilab.fr/ diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/intro/tutorial/components.rst --- a/doc/book/en/intro/tutorial/components.rst Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/intro/tutorial/components.rst Thu May 14 12:48:11 2009 +0200 @@ -70,7 +70,7 @@ database with your model. For this purpose, `CubicWeb` provides a very useful command ``cubicweb-ctl shell blogdemo`` which launches an interactive migration Python shell. (see -:ref:`cubicweb-ctl-shell` for more details)) +:ref:`cubicweb-ctl` for more details)) As you modified a relation from the `BlogEntry` schema, run the following command: :: diff -r 6d541c610165 -r aa09e20dd8c0 doc/book/en/intro/tutorial/create-cube.rst --- a/doc/book/en/intro/tutorial/create-cube.rst Thu May 14 12:43:56 2009 +0200 +++ b/doc/book/en/intro/tutorial/create-cube.rst Thu May 14 12:48:11 2009 +0200 @@ -3,6 +3,10 @@ Create your cube ---------------- +The packages ``cubicweb`` and ``cubicweb-dev`` installs a command line tool +for `CubicWeb` called ``cubicweb-ctl``. This tool provides a wide range of +commands described in details in :ref:`cubicweb-ctl`. + Once your `CubicWeb` development environment is set up, you can create a new cube:: diff -r 6d541c610165 -r aa09e20dd8c0 doc/tools/generate_modules.py --- a/doc/tools/generate_modules.py Thu May 14 12:43:56 2009 +0200 +++ b/doc/tools/generate_modules.py Thu May 14 12:48:11 2009 +0200 @@ -1,99 +1,12 @@ +"""generate list of modules for sphinx doc""" + import sys -""" -Generates the chapter that list all the modules in CubicWeb -in order to pull all the docstring. -""" - -class ModuleGenerator: - HEADER = """.. -*- coding: utf-8 -*- - -============ -CubicWeb API -============ -""" - EXCLUDE_DIRS = ('test', 'tests', 'examples', 'data', 'doc', '.hg', 'migration') - - def __init__(self, output_fn, mod_names): - self.mod_names = mod_names - self.fn = open(output_fn, 'w') - self.fn.write(self.HEADER) - - def done(self): - self.fn.close() - - def gen_module(self, mod_name): - mod_entry = """ -:mod:`%s` -%s - -.. automodule:: %s - :members: -""" % (mod_name, '='*(len(':mod:``'+mod_name)), mod_name) - self.fn.write(mod_entry) - - def find_modules(self): - import os - modules = [] - for mod_name in self.mod_names: - for root, dirs, files in os.walk(mod_name): - if self.keep_module(root): - for name in files: - if name == "__init__.py": - if self.format_mod_name(root, mod_name) not in modules: - modules.append(self.format_mod_name(root, mod_name)) - else: - if name.endswith(".py") and name != "__pkginfo__.py" and "__init__.py" in files: - filename = root + '/' + name.split('.py')[0] - if self.format_mod_name(filename, mod_name) not in modules: - modules.append(self.format_mod_name(filename, mod_name)) - return modules +EXCLUDE_DIRS = ('test', 'tests', 'examples', 'data', 'doc', '.hg', 'migration') +if __name__ == '__main__': - def gen_modules(self): - for module in self.find_modules(): - self.gen_module(module) - - def format_mod_name(self, path, mod_name): - mod_root = mod_name.split('/')[-1] - mod_end = path.split(mod_root)[-1] - return mod_root + mod_end.replace('/', '.') - - def keep_module(self, mod_end): - """ - Filter modules in order to exclude specific package directories. - """ - for dir in self.EXCLUDE_DIRS: - if mod_end.find(dir) != -1: - return False - return True - -USAGE = """ -Two arguments required: - generate_modules [cubicweb-root] [file-out] + from logilab.common.sphinxutils import generate_modules_file -[cubicweb-root] : full path to cubicweb forest -[file-out] : rest file containing the list of modules for Sphinx -""" -def generate_modules_file(args): - if len(args) != 2: - print USAGE - sys.exit() - CW_ROOT = args[0] - OUTPUT = args[1] - modules = (CW_ROOT + '/cubicweb', \ - CW_ROOT + '/indexer', \ - CW_ROOT + '/logilab', \ - CW_ROOT + '/rql', \ - CW_ROOT + '/yams') - - mg = ModuleGenerator(CW_ROOT + '/cubicweb/doc/book/en/' + OUTPUT, modules) - mg.find_modules() - mg.gen_modules() - mg.done() - print args - - - -if __name__ == '__main__': - generate_modules_file(sys.argv[1:]) - + gen = generate_modules_file(sys.argv[1:]) + gen.set_docdir("cubicweb/doc/book/en") + gen.make(['cubicweb', '/indexer', '/logilab', '/rql', '/yams'], EXCLUDE_DIRS) diff -r 6d541c610165 -r aa09e20dd8c0 web/views/old_calendar.py