1
.. IVLE - Informatics Virtual Learning Environment
2
Copyright (C) 2007-2009 The University of Melbourne
4
.. This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
.. This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
.. You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
**************************
21
Frequently Asked Questions
22
**************************
24
This is a list of Frequently Asked Questions for IVLE developers. It answers
25
questions about common issues encountered when bludgeoning the system into
33
.. _ref-dev-faq-config:
35
... get data out of the IVLE configuration?
36
-------------------------------------------
40
from ivle.config import Config
43
This makes `config`, a dictionary-tree containing the whole config hierarchy.
45
For example, to get the Subversion repository path, use
46
``config['paths']['svn']['repo_path']``.
49
For code running inside the jail, you will see different configuration
50
variables than code running outside. It will be missing a lot of data, and
51
will contain some user-specific data.
56
... get the local file path to a user's Subversion repo?
57
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
Get a :ref:`config <ref-dev-faq-config>` object, and use ::
61
repopath = os.path.join(config['paths']['svn']['repo_path'],
64
(This should probably be abstracted.)
66
... get the http:// URL for a user's Subversion repo?
67
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
Get a :ref:`config <ref-dev-faq-config>` object, and use ::
71
repourl = config['urls']['svn_addr'] + '/users/' + username
73
(This should probably be abstracted.)
75
... get a Subversion client from Python?
76
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
svnclient = ivle.svn.create_auth_svn_client(username, password)
83
If you don't have any auth credentials and you just want to do SVN things
84
which don't require auth (though I don't see why this situation would arise),
85
you can get an auth-less SVN client, which will raise exceptions if you try to
86
do authy things (e.g., commit, update or checkout)::
89
svnclient = pysvn.Client()
91
In either case, the client object will raise `pysvn.ClientError` objects, so
92
you should be handling those.
94
You may wish to make error messages simpler using this line::
96
svnclient.exception_style = 0
98
A good example of Subversion client code is in
99
``ivle/fileservice_lib/action.py``.
101
.. _ref-dev-faq-where:
106
.. This is for finding obscure things in the code.