本文整理汇总了Python中pykolab.getConf函数的典型用法代码示例。如果您正苦于以下问题:Python getConf函数的具体用法?Python getConf怎么用?Python getConf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getConf函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *args, **kw):
# load pykolab conf
conf = pykolab.getConf()
if not hasattr(conf, 'defaults'):
conf.finalize_conf(fatal=False)
self.imap = IMAP()
示例2: setup_class
def setup_class(self, *args, **kw):
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
self.login = conf.get('ldap', 'bind_dn')
self.password = conf.get('ldap', 'bind_pw')
self.domain = conf.get('kolab', 'primary_domain')
示例3: __init__
def __init__(self, *args, **kw):
# load pykolab conf
self.pykolab_conf = pykolab.getConf()
if not hasattr(self.pykolab_conf, 'defaults'):
self.pykolab_conf.finalize_conf(fatal=False)
self.ldap = Auth()
self.ldap.connect()
示例4: send_reply
def send_reply(from_address, itip_events, response_text, subject=None):
"""
Send the given iCal events as a valid iTip REPLY to the organizer.
"""
import smtplib
conf = pykolab.getConf()
smtp = None
if isinstance(itip_events, dict):
itip_events = [ itip_events ]
for itip_event in itip_events:
attendee = itip_event['xml'].get_attendee_by_email(from_address)
participant_status = itip_event['xml'].get_ical_attendee_participant_status(attendee)
log.debug(_("Send iTip reply %s for %s %r") % (participant_status, itip_event['xml'].type, itip_event['xml'].uid), level=8)
event_summary = itip_event['xml'].get_summary()
message_text = response_text % { 'summary':event_summary, 'status':participant_status_label(participant_status), 'name':attendee.get_name() }
if subject is not None:
subject = subject % { 'summary':event_summary, 'status':participant_status_label(participant_status), 'name':attendee.get_name() }
try:
message = itip_event['xml'].to_message_itip(from_address,
method="REPLY",
participant_status=participant_status,
message_text=message_text,
subject=subject
)
except Exception, e:
log.error(_("Failed to compose iTip reply message: %r: %s") % (e, traceback.format_exc()))
return
smtp = smtplib.SMTP("localhost", 10026) # replies go through wallace again
if conf.debuglevel > 8:
smtp.set_debuglevel(True)
try:
smtp.sendmail(message['From'], message['To'], message.as_string())
except Exception, e:
log.error(_("SMTP sendmail error: %r") % (e))
示例5: test_001_list_options_user_preferredlanguage
def test_001_list_options_user_preferredlanguage(self):
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
self.login = conf.get('ldap', 'bind_dn')
self.password = conf.get('ldap', 'bind_pw')
self.domain = conf.get('kolab', 'primary_domain')
result = wap_client.authenticate(self.login, self.password, self.domain)
attribute_values = wap_client.form_value_select_options(
'user',
1,
'preferredlanguage'
)
self.assertTrue(attribute_values['preferredlanguage'].has_key('default'))
self.assertTrue(attribute_values['preferredlanguage'].has_key('list'))
self.assertTrue(len(attribute_values['preferredlanguage']['list']) > 1)
self.assertTrue(attribute_values['preferredlanguage']['default'] in attribute_values['preferredlanguage']['list'])
示例6: send_request
def send_request(to_address, itip_events, request_text, subject=None, direct=False):
"""
Send an iTip REQUEST message from the given iCal events
"""
import smtplib
conf = pykolab.getConf()
smtp = None
if isinstance(itip_events, dict):
itip_events = [ itip_events ]
for itip_event in itip_events:
event_summary = itip_event['xml'].get_summary()
message_text = request_text % { 'summary':event_summary }
if subject is not None:
subject = subject % { 'summary':event_summary }
try:
message = itip_event['xml'].to_message_itip(None,
method="REQUEST",
message_text=message_text,
subject=subject
)
except Exception, e:
log.error(_("Failed to compose iTip request message: %r") % (e))
return
port = 10027 if direct else 10026
smtp = smtplib.SMTP("localhost", port)
if conf.debuglevel > 8:
smtp.set_debuglevel(True)
try:
smtp.sendmail(message['From'], to_address, message.as_string())
except Exception, e:
log.error(_("SMTP sendmail error: %r") % (e))
示例7: __init__
def __init__(self):
self.primaryDomain = "example.org"
self.resourceOu = u'ou=Resources,dc=example,dc=org'
self.conf = pykolab.getConf()
self.conf.finalize_conf()
示例8: __init__
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import commands
import pykolab
from pykolab.imap import IMAP
from pykolab.translate import _
log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()
def __init__():
commands.register('undelete_mailbox', execute, description=description())
def cli_options():
my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
my_option_group.add_option( '--dry-run',
dest = "dry_run",
action = "store_true",
default = False,
help = _("Do not actually execute, but state what would have been executed."))
def description(*args, **kw):
return _("Recover mailboxes previously deleted.")
示例9: setup_package
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)