# HG changeset patch # User Sandrine Ribeau # Date 1231275227 28800 # Node ID 25aae8a1553200052ac1a05b312ce6017dcfbe0d # Parent eb329d0db46703448a5c01c39b57325876ffe872# Parent f75b6d4e3ff110ff1b3620b610f118b3ebdbfd3b merge diff -r f75b6d4e3ff1 -r 25aae8a15532 doc/book/en/C040-rql.en.txt --- a/doc/book/en/C040-rql.en.txt Tue Jan 06 18:22:39 2009 +0100 +++ b/doc/book/en/C040-rql.en.txt Tue Jan 06 12:53:47 2009 -0800 @@ -533,6 +533,17 @@ is not. +RQL logs +-------- + +You can configure the `CubicWeb` application so that you keep a log +of the queries executed against your database. To do so, you want to +edit the configuration file of your application +``.../etc/cubicweb.d/myapp/all-in-one.conf`` and uncomment the +variable ``query-log-file``: :: + + # web application query log file + query-log-file=/tmp/rql-myapp.log Conclusion diff -r f75b6d4e3ff1 -r 25aae8a15532 doc/book/en/D010-faq.en.txt --- a/doc/book/en/D010-faq.en.txt Tue Jan 06 18:22:39 2009 +0100 +++ b/doc/book/en/D010-faq.en.txt Tue Jan 06 12:53:47 2009 -0800 @@ -16,19 +16,46 @@ It does. Actually, you can use your preferred template language if you want. [explain how to use a template language] + `CubicWeb` does not define its own templating language as this was + not our goal and emphasize. Based on our experience, we realized that + we could gain productivity by letting designers use design tools + and developpers develop without the use of the templating language + as an intermediary that could not be anyway efficient for both parties. + Python is the templating language that we use in `CubicWeb`, but again, + it does not prevent you from using a templating language. + The reason template languages are not used in this book is that experience has proved us that using pure python was more efficient. * Why do you think using pure python is better than using a template language ? - [copy answer from forum] + Python is an Object Oriented Programming language and as such it + already provides a consistent and strong architecture and syntax + a templating language would not reach. + + When doing development, you need a real language and template + languages are not real language. + + Using Python enables developing applications for which code is + easier to maintain with real functions/classes + without the need of learning a new dialect. By using Python, + we use standard OOP techniques and this is a key factor in a + robust application. - code is easier to maintain, does not have to learn a new dialect - each time, real function/classes etc -> real development +* Why do you use the GPL license to prevent me from doing X? -* Why do you use the GPL license to prevent me from doing X ? - - [copy answer from forum] + GPL means that *if* you redistribute your application, you need to + redistribute it *and* the changes you made *and* the code _linked_ + to it under the GPL licence. + + Publishing a web site has nothing to do with redistributing + source code. A fair amount of companies use modified GPL code + for internal use. And someone could publish a `CubicWeb` component + under a BSD licence for others to plug into a GPL framework without + any problem. The only thing we are trying to prevent here is someone + taking the framework and packaging it as closed source to his own + clients. + * CubicWeb looks pretty recent. Is it stable ? @@ -37,7 +64,24 @@ * Why is the RQL query language looking similar to X ? - [copy answer from forum, explain why similar to sparql and why better + 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. + Having SPARQL has a query language has been in our backlog for years. + + That RQL language is what is going to make a difference with django- + like frameworks for several reasons. + + 1. accessing data is *much* easier with it. One can write complex + queries with RQL that would just be impossible to define or unreadable + using an object/filter suite of method calls. + + 2. it offers an abstraction layers that allows to have a single + framework that runs on multiple back-ends. We have not published the + SQL backend yet (still working on separating it clearly from other + backends), but we already have components (pieces of schema and views) + that run both on SQL and AppEngine. + +[copy answer from forum, explain why similar to sparql and why better than django and SQL] * which ajax library @@ -134,5 +178,59 @@ where DATADIR is ``mycubes/data``. +* How to import LDAP users in `CubicWeb`? + + Here is a very usefull script which enables you to import LDAP users + into your `CubicWeb` application by runing the following: :: + + + import os + import pwd + import sys + + from logilab.common.db import get_connection + + def getlogin(): + """avoid usinng os.getlogin() because of strange tty / stdin problems + (man 3 getlogin) + Another solution would be to use $LOGNAME, $USER or $USERNAME + """ + return pwd.getpwuid(os.getuid())[0] + + + try: + database = sys.argv[1] + except IndexError: + print 'USAGE: python ldap2system.py ' + sys.exit(1) + + if raw_input('update %s db ? [y/n]: ' % database).strip().lower().startswith('y'): + cnx = get_connection(user=getlogin(), database=database) + cursor = cnx.cursor() + + insert = ('INSERT INTO euser (creation_date, eid, modification_date, login, firstname, surname, last_login_time, upassword) ' + "VALUES (%(mtime)s, %(eid)s, %(mtime)s, %(login)s, %(firstname)s, %(surname)s, %(mtime)s, './fqEz5LeZnT6');") + update = "UPDATE entities SET source='system' WHERE eid=%(eid)s;" + cursor.execute("SELECT eid,type,source,extid,mtime FROM entities WHERE source!='system'") + for eid, type, source, extid, mtime in cursor.fetchall(): + if type != 'EUser': + print "don't know what to do with entity type", type + continue + if source != 'ldapuser': + print "don't know what to do with source type", source + continue + ldapinfos = dict(x.strip().split('=') for x in extid.split(',')) + login = ldapinfos['uid'] + firstname = ldapinfos['uid'][0].upper() + surname = ldapinfos['uid'][1:].capitalize() + if login != 'jcuissinat': + args = dict(eid=eid, type=type, source=source, login=login, + firstname=firstname, surname=surname, mtime=mtime) + print args + cursor.execute(insert, args) + cursor.execute(update, args) + + cnx.commit() + cnx.close()