doc/book/en/annexes/faq.rst
branchstable
changeset 7813 89ab98c4aaab
parent 7529 2fdc310be7cd
child 8032 bcb87336c7d2
equal deleted inserted replaced
7811:c468ff909e98 7813:89ab98c4aaab
   146 .. note::
   146 .. note::
   147     While creating a new instance, you can decide to allow access
   147     While creating a new instance, you can decide to allow access
   148     to anonymous user, which will automatically execute what is
   148     to anonymous user, which will automatically execute what is
   149     decribed above.
   149     decribed above.
   150 
   150 
   151 How to load data from a script ?
   151 How to load data from a python script ?
   152 --------------------------------
   152 ---------------------------------------
   153 
   153 Please, refer to the `Pyro chapter`_.
   154 The following script aims at loading data within a script assuming pyro-nsd is
   154 
   155 running and your instance is configured with ``pyro-server=yes``, otherwise
   155 .. _`Pyro chapter`: UsingPyro_
   156 you would not be able to use dbapi.
   156 
   157 
       
   158 .. sourcecode:: python
       
   159 
       
   160     from cubicweb import dbapi
       
   161 
       
   162     cnx = dbapi.connect(database='instance-id', user='admin', password='admin')
       
   163     cur = cnx.cursor()
       
   164     for name in (u'Personal', u'Professional', u'Computers'):
       
   165         cur.execute('INSERT Tag T: T name %(n)s', {'n': name})
       
   166     cnx.commit()
       
   167 
       
   168 Wether your instance as pyro activated or not, you can still acheive this by
       
   169 using cubicweb-ctl shell scripts.
       
   170 
   157 
   171 How to format an entity date attribute ?
   158 How to format an entity date attribute ?
   172 ----------------------------------------
   159 ----------------------------------------
   173 
   160 
   174 If your schema has an attribute of type `Date` or `Datetime`, you usually want to
   161 If your schema has an attribute of type `Date` or `Datetime`, you usually want to