This commit is contained in:
Kloadut 2012-10-07 18:20:06 +02:00
parent ebf1e7d684
commit 7e701b03f9
2 changed files with 12 additions and 11 deletions

View file

@ -26,7 +26,7 @@ class YunoHostLDAP:
try: try:
self.conn.unbind_s() self.conn.unbind_s()
except: except:
print(_('Error: A problem occured on LDAP unbind')) print(msg.error + _('A problem occured on LDAP unbind'))
return False return False
else: else:
return True return True
@ -40,7 +40,7 @@ class YunoHostLDAP:
try: try:
result = self.conn.search_s(base, ldap.SCOPE_ONELEVEL, filter, attrs) result = self.conn.search_s(base, ldap.SCOPE_ONELEVEL, filter, attrs)
except Exception: except Exception:
print(_('Error: An error occured on LDAP search')) print(msg.error + _('An error occured on LDAP search'))
return False return False
if result: if result:

View file

@ -17,7 +17,7 @@ __credits__ = """
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses along with this program; if not, see http://www.gnu.org/licenses
""" """
__author__ = 'Kload' __author__ = 'Kload <kload@kload.fr>'
__version__ = '2.0 beta1' __version__ = '2.0 beta1'
import sys import sys
@ -102,7 +102,11 @@ def parse_args(parsers):
#argparse.ArgumentParser.add_argument #argparse.ArgumentParser.add_argument
""" """
# General #####################
# General #
#####################
# Version
parsers['general'].add_argument( parsers['general'].add_argument(
'-v', '-v',
'--version', '--version',
@ -115,11 +119,7 @@ def parse_args(parsers):
##################### #####################
# user list # user list
parsers['user_list'].add_argument( parsers['user_list'].add_argument('-a', '--all', action='store_true')
'-a',
'--all',
action='store'
)
# user add # user add
parsers['user_add'].add_argument('-u', '--username') parsers['user_add'].add_argument('-u', '--username')
@ -129,9 +129,10 @@ def parse_args(parsers):
parsers['user_add'].add_argument('-p', '--password') parsers['user_add'].add_argument('-p', '--password')
# Call arguments parsing #########################
# End of arguments #
#########################
args = parsers['general'].parse_args() args = parsers['general'].parse_args()
return args return args