Projects
Kolab:Winterfell
pykolab
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
pykolab-0.8.1.tar.gz/kolabd/__init__.py
Changed
@@ -218,7 +218,7 @@ exitcode = 1 traceback.print_exc() print >> sys.stderr, _("Traceback occurred, please report a " + \ - "bug at http://bugzilla.kolabsys.com") + "bug at https://issues.kolab.org") except TypeError, errmsg: exitcode = 1 @@ -229,7 +229,7 @@ exitcode = 2 traceback.print_exc() print >> sys.stderr, _("Traceback occurred, please report a " + \ - "bug at http://bugzilla.kolabsys.com") + "bug at https://issues.kolab.org") sys.exit(exitcode)
View file
pykolab-0.8.1.tar.gz/pykolab/imap/__init__.py
Changed
@@ -536,15 +536,20 @@ from pykolab.auth import Auth auth = Auth() auth.connect() - domains = auth._list_domains(self.domain) + + domains = auth.list_domains(self.domain) + auth.disconnect() - if len(domains) > 0: - (primary,secondaries) = domains1 - if conf.has_option(primary, "autocreate_folders"): - _additional_folders = conf.get_raw( - primary, - "autocreate_folders" - ) + + if len(domains.keys()) > 0: + if domains.has_key(self.domain): + primary = domainsself.domain + + if conf.has_option(primary, "autocreate_folders"): + _additional_folders = conf.get_raw( + primary, + "autocreate_folders" + ) if _additional_folders == None: if conf.has_option('kolab', "autocreate_folders"):
View file
pykolab-0.8.1.tar.gz/pykolab/imap/cyrus.py
Changed
@@ -25,12 +25,14 @@ import pykolab +from pykolab.constants import * from pykolab.imap import IMAP from pykolab.translate import _ log = pykolab.getLogger('pykolab.imap') conf = pykolab.getConf() + class Cyrus(cyruslib.CYRUS): """ Abstraction class for some common actions to do exclusively in Cyrus. @@ -70,14 +72,19 @@ self.server = hostname - self.uri = "%s://%s:%s" % (scheme,hostname,port) + self.uri = "%s://%s:%s" % (scheme, hostname, port) while 1: try: cyruslib.CYRUS.__init__(self, self.uri) break except cyruslib.CYRUSError: - log.warning(_("Could not connect to Cyrus IMAP server %r") % (self.uri)) + log.warning( + _("Could not connect to Cyrus IMAP server %r") % ( + self.uri + ) + ) + time.sleep(10) if conf.debuglevel > 8: @@ -134,17 +141,32 @@ """ cyruslib.CYRUS.login(self, *args, **kw) self.separator = self.SEP + try: + self._id() + except Exception, errmsg: + pass + + log.debug( + _("Continuing with separator: %r") % (self.separator), + level=8 + ) - log.debug(_("Continuing with separator: %r") % (self.separator), level=8) self.murder = False for capability in self.m.capabilities: if capability.startswith("MUPDATE="): - log.debug(_("Detected we are running in a Murder topology"), level=8) + log.debug( + _("Detected we are running in a Murder topology"), + level=8 + ) + self.murder = True if not self.murder: - log.debug(_("This system is not part of a murder topology"), level=8) + log.debug( + _("This system is not part of a murder topology"), + level=8 + ) def find_mailfolder_server(self, mailfolder): annotations = {} @@ -153,8 +175,13 @@ prefix = _mailfolder'path_parts'.pop(0) mbox = _mailfolder'path_parts'.pop(0) - if not _mailfolder'domain' == None: - mailfolder = "%s%s%s@%s" % (prefix,self.separator,mbox,_mailfolder'domain') + if _mailfolder'domain' is not None: + mailfolder = "%s%s%s@%s" % ( + prefix, + self.separator, + mbox, + _mailfolder'domain' + ) # TODO: Workaround for undelete if len(self.lm(mailfolder)) < 1: @@ -165,14 +192,20 @@ if not self.murder: return self.server - log.debug(_("Checking actual backend server for folder %s through annotations") % (mailfolder), level=8) + log.debug( + _("Checking actual backend server for folder %s " + + "through annotations") % ( + mailfolder + ), + level=8 + ) if self.mbox.has_key(mailfolder): log.debug( _( - "Possibly reproducing the find " + \ - "mailfolder server answer from " + \ - "previously detected and stored " + \ + "Possibly reproducing the find " + + "mailfolder server answer from " + + "previously detected and stored " + "annotation value: %r" ) % ( self.mboxmailfolder @@ -185,26 +218,53 @@ max_tries = 20 num_try = 0 + + annotation_path = "/shared/vendor/cmu/cyrus-imapd/server" + while 1: num_try += 1 - annotations = self._getannotation(mailfolder, "/vendor/cmu/cyrus-imapd/server") + annotations = self._getannotation( + mailfolder, + annotation_path + ) if annotations.has_key(mailfolder): break if max_tries <= num_try: - log.error(_("Could not get the annotations after %s tries.") % (num_try)) - annotations = { mailfolder: { '/shared/vendor/cmu/cyrus-imapd/server': self.server }} + log.error( + _("Could not get the annotations after %s tries.") % ( + num_try + ) + ) + + annotations = { + mailfolder: { + annotation_path: self.server + } + } + break - log.warning(_("No annotations for %s: %r") % (mailfolder,annotations)) + log.warning( + _("No annotations for %s: %r") % ( + mailfolder, + annotations + ) + ) time.sleep(1) - server = annotationsmailfolder'/shared/vendor/cmu/cyrus-imapd/server' + server = annotationsmailfolderannotation_path self.mboxmailfolder = server - log.debug(_("Server for INBOX folder %s is %s") % (mailfolder,server), level=8) + log.debug( + _("Server for INBOX folder %s is %s") % ( + mailfolder, + server + ), + level=8 + ) return server @@ -216,33 +276,68 @@ from pykolab import imap_utf7 return imap_utf7.decode(folder) + def _id(self, identity=None): + if identity is None: + identity = '("name" "Python/Kolab" "version" "%s")' % (__version__) + + typ, dat = self.m._simple_command('ID', identity) + res, dat = self.m._untagged_response(typ, dat, 'ID') + def _setquota(self, mailfolder, quota): """ Login to the actual backend server. """ server = self.find_mailfolder_server(mailfolder) - #print "server:", server - self.connect(self.uri.replace(self.server,server)) + self.connect(self.uri.replace(self.server, server)) + + log.debug( + _("Setting quota for folder %s to %s") % ( + mailfolder, + quota + ), + level=8 + ) - log.debug(_("Setting quota for folder %s to %s") % (mailfolder,quota), level=8) try: self.m.setquota(mailfolder, quota) except: - log.error(_("Could not set quota for mailfolder %s") % (mailfolder)) + log.error( + _("Could not set quota for mailfolder %s") % ( + mailfolder + ) + ) def _rename(self, from_mailfolder, to_mailfolder, partition=None): """ Login to the actual backend server, then rename. """ server = self.find_mailfolder_server(from_mailfolder) - self.connect(self.uri.replace(self.server,server)) + self.connect(self.uri.replace(self.server, server)) + + if partition is not None: + log.debug( + _("Moving INBOX folder %s to %s on partition %s") % ( + from_mailfolder, + to_mailfolder, + partition + ), + level=8 + ) - if not partition == None: - log.debug(_("Moving INBOX folder %s to %s on partition %s") % (from_mailfolder,to_mailfolder, partition), level=8) else: - log.debug(_("Moving INBOX folder %s to %s") % (from_mailfolder,to_mailfolder), level=8) + log.debug( + _("Moving INBOX folder %s to %s") % ( + from_mailfolder, + to_mailfolder + ), + level=8 + ) - self.m.rename(self.folder_utf7(from_mailfolder), self.folder_utf7(to_mailfolder), '"%s"' % (partition)) + self.m.rename( + self.folder_utf7(from_mailfolder), + self.folder_utf7(to_mailfolder), + '"%s"' % (partition) + ) def _getannotation(self, *args, **kw): return self.getannotation(*args, **kw) @@ -256,24 +351,49 @@ except: server = self.server - log.debug(_("Setting annotation %s on folder %s") % (annotation,mailfolder), level=8) + log.debug( + _("Setting annotation %s on folder %s") % ( + annotation, + mailfolder + ), + level=8 + ) try: self.setannotation(mailfolder, annotation, value, shared) - except cyruslib.CYRUSError, e: - log.error(_("Could not set annotation %r on mail folder %r: %r") % (annotation,mailfolder,e)) + except cyruslib.CYRUSError, errmsg: + log.error( + _("Could not set annotation %r on mail folder %r: %r") % ( + annotation, + mailfolder, + errmsg + ) + ) def _xfer(self, mailfolder, current_server, new_server): - self.connect(self.uri.replace(self.server,current_server)) - log.debug(_("Transferring folder %s from %s to %s") % (mailfolder, current_server, new_server), level=8) + self.connect(self.uri.replace(self.server, current_server)) + log.debug( + _("Transferring folder %s from %s to %s") % ( + mailfolder, + current_server, + new_server + ), + level=8 + ) + self.xfer(mailfolder, new_server) - def undelete_mailfolder(self, mailfolder, to_mailfolder=None, recursive=True): + def undelete_mailfolder( + self, + mailfolder, + to_mailfolder=None, + recursive=True + ): """ Login to the actual backend server, then "undelete" the mailfolder. - 'mailfolder' may be a string representing either of the following two - options; + 'mailfolder' may be a string representing either of the following + two options; - the fully qualified pathof the deleted folder in its current location, such as, for a deleted INBOX folder originally known as @@ -295,7 +415,7 @@ undelete_folders = self._find_deleted_folder(mailfolder) - if not to_mailfolder == None: + if to_mailfolder is not None: target_mbox = self.parse_mailfolder(to_mailfolder) else: target_mbox = mailfolder @@ -306,39 +426,68 @@ prefix = undelete_mbox'path_parts'.pop(0) mbox = undelete_mbox'path_parts'.pop(0) - if to_mailfolder == None: - target_folder = self.separator.join(prefix,mbox) + if to_mailfolder is None: + target_folder = self.separator.join(prefix, mbox) else: target_folder = self.separator.join(target_mbox'path_parts') - if not to_mailfolder == None: - target_folder = "%s%s%s" % (target_folder,self.separator,mbox) + if to_mailfolder is not None: + target_folder = "%s%s%s" % ( + target_folder, + self.separator, + mbox + ) if not len(undelete_mbox'path_parts') == 0: - target_folder = "%s%s%s" % (target_folder,self.separator,self.separator.join(undelete_mbox'path_parts')) + target_folder = "%s%s%s" % ( + target_folder, + self.separator, + self.separator.join(undelete_mbox'path_parts') + ) if target_folder in target_folders: - target_folder = "%s%s%s" % (target_folder,self.separator,undelete_mbox'hex_timestamp') + target_folder = "%s%s%s" % ( + target_folder, + self.separator, + undelete_mbox'hex_timestamp' + ) target_folders.append(target_folder) - if not target_mbox'domain' == None: - target_folder = "%s@%s" % (target_folder,target_mbox'domain') - - log.info(_("Undeleting %s to %s") % (undelete_folder,target_folder)) + if target_mbox'domain' is not None: + target_folder = "%s@%s" % ( + target_folder, + target_mbox'domain' + ) + + log.info( + _("Undeleting %s to %s") % ( + undelete_folder, + target_folder + ) + ) target_server = self.find_mailfolder_server(target_folder) - if hasattr(conf,'dry_run') and not conf.dry_run: - if not target_server == self.server: - self.xfer(undelete_folder,target_server) + if hasattr(conf, 'dry_run') and not conf.dry_run: + if target_server is not self.server: + self.xfer(undelete_folder, target_server) - self.rename(undelete_folder,target_folder) + self.rename(undelete_folder, target_folder) else: if not target_server == self.server: - print >> sys.stdout, _("Would have transferred %s from %s to %s") % (undelete_folder, self.server, target_server) - - print >> sys.stdout, _("Would have renamed %s to %s") % (undelete_folder, target_folder) + print >> sys.stdout, \ + _("Would have transferred %s from %s to %s") % ( + undelete_folder, + self.server, + target_server + ) + + print >> sys.stdout, \ + _("Would have renamed %s to %s") % ( + undelete_folder, + target_folder + ) def parse_mailfolder(self, mailfolder): """ @@ -361,15 +510,16 @@ mbox'path_parts' = mailfolder.split(self.separator) # See if the path that has been specified is the current location for - # the deleted folder, or the original location, we have to find the deleted - # folder for. - if not mbox'path_parts'0 in 'user', 'shared' : + # the deleted folder, or the original location, we have to find the + # deleted folder for. + if not mbox'path_parts'0 in 'user', 'shared': deleted_prefix = mbox'path_parts'.pop(0) # See if the hexadecimal timestamp is actually hexadecimal. # This prevents "DELETED/user/userid/Sent", but not # "DELETED/user/userid/FFFFFF" from being specified. try: - epoch = int(mbox'path_parts'(len(mbox'path_parts')-1), 16) + hexstamp = mbox'path_parts'(len(mbox'path_parts')-1) + epoch = int(hexstamp, 16) try: timestamp = time.asctime(time.gmtime(epoch)) except: @@ -385,22 +535,28 @@ 'mailfolder': self.separator.join(mbox'path_parts') } - if not mbox'domain' == None: - verify_folder_search = "%s@%s" % (verify_folder_search, mbox'domain') + if mbox'domain' is not None: + verify_folder_search = "%s@%s" % ( + verify_folder_search, + mbox'domain' + ) if ' ' in verify_folder_search: - folders = self.lm('"%s"' % self.folder_utf7(verify_folder_search)) + folders = self.lm( + '"%s"' % self.folder_utf7(verify_folder_search) + ) + else: folders = self.lm(self.folder_utf7(verify_folder_search)) - # NOTE: Case also covered is valid hexadecimal folders; won't be the - # actual check as intended, but doesn't give you anyone else's data - # unless... See the following: + # NOTE: Case also covered is valid hexadecimal folders; won't be + # the actual check as intended, but doesn't give you anyone else's + # data unless... See the following: # # TODO: Case not covered is usernames that are hexadecimal. # - # We could probably attempt to convert the int(hex) into a time.gmtime(), - # but it still would not cover all cases. + # We could probably attempt to convert the int(hex) into a + # time.gmtime(), but it still would not cover all cases. # # If no folders were found... well... then there you go. @@ -414,20 +570,24 @@ def _find_deleted_folder(self, mbox): """ - Give me the parts that are in an original mailfolder name and I'll find - the deleted folder name. + Give me the parts that are in an original mailfolder name and I'll + find the deleted folder name. TODO: It finds virtdomain folders for non-virtdomain searches. """ - deleted_folder_search = "%(deleted_prefix)s%(separator)s%(mailfolder)s%(separator)s*" % { - # TODO: The prefix used is configurable - 'deleted_prefix': "DELETED", - 'mailfolder': self.separator.join(mbox'path_parts'), - 'separator': self.separator, - } + deleted_folder_search = "%(deleted_prefix)s%(separator)s" + \ + "%(mailfolder)s%(separator)s*" % { + # TODO: The prefix used is configurable + 'deleted_prefix': "DELETED", + 'mailfolder': self.separator.join(mbox'path_parts'), + 'separator': self.separator, + } - if not mbox'domain' == None: - deleted_folder_search = "%s@%s" % (deleted_folder_search,mbox'domain') + if mbox'domain' is not None: + deleted_folder_search = "%s@%s" % ( + deleted_folder_search, + mbox'domain' + ) folders = self.lm(deleted_folder_search) @@ -438,7 +598,7 @@ # # Here, we explicitly remove any virtdomain folders. - if mbox'domain' == None: + if mbox'domain' is None: _folders = for folder in folders: if len(folder.split('@')) < 2:
View file
pykolab-0.8.1.tar.gz/pykolab/setup/setup_roundcube.py
Changed
@@ -193,7 +193,6 @@ if not schema_filepath in schema_files: schema_files.append(schema_filepath) - schema_files = for root, directories, filenames in os.walk('/usr/share/doc/'): directories.sort() for directory in directories:
View file
pykolab-0.8.1.tar.gz/saslauthd/__init__.py
Changed
@@ -166,7 +166,7 @@ except AttributeError, e: exitcode = 1 traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://bugzilla.kolabsys.com") + print >> sys.stderr, _("Traceback occurred, please report a bug at https://issues.kolab.org") except TypeError, e: exitcode = 1 traceback.print_exc() @@ -174,7 +174,7 @@ except: exitcode = 2 traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://bugzilla.kolabsys.com") + print >> sys.stderr, _("Traceback occurred, please report a bug at https://issues.kolab.org") sys.exit(exitcode)
View file
pykolab-0.8.1.tar.gz/share/templates/roundcubemail/kolab_delegation.inc.php.tpl
Changed
@@ -8,18 +8,6 @@ // Note: LDAP addressbook defined for kolab_auth plugin is used \$config'kolab_delegation_delegate_field' = 'kolabDelegate'; - // User authentication ID field (from fieldmap configuration) - // See kolab_auth plugin config - \$config'kolab_delegation_login_field' = 'email'; - - // Use this fields (from fieldmap configuration) for identities - // If the value array contains more than one field, first non-empty will be used - // Note: These are not LDAP attributes, but field names in config - // Note: If there are more than one email address, as many identities will be created - // See kolab_auth plugin config - \$config'kolab_delegation_name_field' = array('name', 'cn'); - \$config'kolab_delegation_email_field' = array('email'); - // Remove all user identities which do not match the users primary or alias // addresses and delegators addresses \$config'kolab_delegation_purge_identities' = false;
View file
pykolab-0.8.1.tar.gz/wallace/__init__.py
Changed
@@ -464,7 +464,7 @@ except AttributeError, e: exitcode = 1 traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://bugzilla.kolabsys.com") + print >> sys.stderr, _("Traceback occurred, please report a bug at https://issues.kolab.org") except TypeError, e: exitcode = 1 @@ -473,7 +473,7 @@ except: exitcode = 2 traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://bugzilla.kolabsys.com") + print >> sys.stderr, _("Traceback occurred, please report a bug at https://issues.kolab.org") sys.exit(exitcode)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.