| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | ## |
|---|
| 3 | ## |
|---|
| 4 | ## This file is part of CDS Indico. |
|---|
| 5 | ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. |
|---|
| 6 | ## |
|---|
| 7 | ## CDS Indico is free software; you can redistribute it and/or |
|---|
| 8 | ## modify it under the terms of the GNU General Public License as |
|---|
| 9 | ## published by the Free Software Foundation; either version 2 of the |
|---|
| 10 | ## License, or (at your option) any later version. |
|---|
| 11 | ## |
|---|
| 12 | ## CDS Indico is distributed in the hope that it will be useful, but |
|---|
| 13 | ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | ## General Public License for more details. |
|---|
| 16 | ## |
|---|
| 17 | ## You should have received a copy of the GNU General Public License |
|---|
| 18 | ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., |
|---|
| 19 | ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 20 | |
|---|
| 21 | """ |
|---|
| 22 | DB Update and related matters |
|---|
| 23 | |
|---|
| 24 | This should be easy to adapt to InTRePId 2, in the case of its acceptance. |
|---|
| 25 | """ |
|---|
| 26 | |
|---|
| 27 | # plugin imports |
|---|
| 28 | from indico.ext.livesync.util import getPluginType |
|---|
| 29 | from indico.ext.livesync.agent import SyncManager |
|---|
| 30 | |
|---|
| 31 | from indico.core.api.db import DBUpdateException |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | def updateDBStructures(root): |
|---|
| 35 | """ |
|---|
| 36 | Updates the DB for use with livesync |
|---|
| 37 | """ |
|---|
| 38 | |
|---|
| 39 | # get our storage |
|---|
| 40 | ptype = getPluginType() |
|---|
| 41 | storage = ptype.getStorage() |
|---|
| 42 | |
|---|
| 43 | # check if it is empty |
|---|
| 44 | if len(storage) == 0: |
|---|
| 45 | # nice, let's fill it |
|---|
| 46 | storage['agent_manager'] = SyncManager() |
|---|
| 47 | return True |
|---|
| 48 | |
|---|
| 49 | else: |
|---|
| 50 | raise Exception("") |
|---|