4 |
# |
# |
5 |
# This file is part of GNU Enterprise. |
# This file is part of GNU Enterprise. |
6 |
# |
# |
7 |
# GNU Enterprise is free software; you can redistribute it |
# GNU Enterprise is free software; you can redistribute it |
8 |
# and/or modify it under the terms of the GNU General Public |
# and/or modify it under the terms of the GNU General Public |
9 |
# License as published by the Free Software Foundation; either |
# License as published by the Free Software Foundation; either |
10 |
# version 2, or (at your option) any later version. |
# version 2, or (at your option) any later version. |
11 |
# |
# |
12 |
# GNU Enterprise is distributed in the hope that it will be |
# GNU Enterprise is distributed in the hope that it will be |
13 |
# useful, but WITHOUT ANY WARRANTY; without even the implied |
# useful, but WITHOUT ANY WARRANTY; without even the implied |
14 |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
15 |
# PURPOSE. See the GNU General Public License for more details. |
# PURPOSE. See the GNU General Public License for more details. |
16 |
# |
# |
17 |
# You should have received a copy of the GNU General Public |
# You should have received a copy of the GNU General Public |
18 |
# License along with program; see the file COPYING. If not, |
# License along with program; see the file COPYING. If not, |
19 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
20 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
21 |
# |
# |
22 |
# $Id$ |
# $Id$ |
54 |
|
|
55 |
|
|
56 |
# ============================================================================= |
# ============================================================================= |
57 |
# Database Authentification Agent |
# Database Authentification Agent |
58 |
# ============================================================================= |
# ============================================================================= |
59 |
|
|
60 |
class geasPythonDBTriggerMg(geasTriggerManager): |
class geasPythonDBTriggerMg(geasTriggerManager): |
83 |
triggerList.populate () |
triggerList.populate () |
84 |
|
|
85 |
instance = triggerList.firstInstance () |
instance = triggerList.firstInstance () |
86 |
|
|
87 |
# no such trigger |
# no such trigger |
88 |
if instance==None: |
if instance==None: |
89 |
# log something |
# log something |
90 |
print _("Trigger '%s' does not exist.") % triggername |
print _("Trigger '%s' does not exist.") % triggername |
91 |
|
|
92 |
return None |
return None |
93 |
|
|
94 |
code=instance.get('code') |
code=instance.get('code') |
95 |
# format code |
# format code |
96 |
|
|
97 |
ccode=compile (code,'<string>','exec') |
ccode=compile (code,'<string>','exec') |
98 |
myfunc=new.function(ccode, {'session':self._session}, triggername) |
myfunc=new.function(ccode, {'session':self._session}, triggername) |
99 |
|
|
100 |
return myfunc |
return myfunc |
101 |
|
|
102 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
114 |
triggerList.populate () |
triggerList.populate () |
115 |
|
|
116 |
instance = triggerList.firstInstance () |
instance = triggerList.firstInstance () |
117 |
|
|
118 |
# no such trigger |
# no such trigger |
119 |
if instance==None: |
if instance==None: |
120 |
# log something |
# log something |
121 |
# print _("Trigger for event '%s' does not exist.") % eventname |
# print _("Trigger for event '%s' does not exist.") % eventname |
122 |
|
|
123 |
return None |
return None |
124 |
|
|
125 |
code=instance.get('code') |
code=instance.get('code') |
126 |
# format code |
# format code |
127 |
|
|
128 |
ccode=compile (code,'<string>','exec') |
ccode=compile (code,'<string>','exec') |
129 |
myfunc=new.function(ccode, {'session':self._session}, instance.get('name')) |
myfunc=new.function(ccode, {'session':self._session}, instance.get('name')) |
130 |
|
|
131 |
return myfunc |
return myfunc |
132 |
|
|