auth bilgisi her host için farklı olacak. bunun dışında her kullanıcı için de farklı olabilir. bu yüzden configfile'da bunu tutmak mantıklı değil.
This commit is contained in:
+10
-6
@@ -47,12 +47,16 @@ class Command(object):
|
|||||||
def checkAuthInfo(self):
|
def checkAuthInfo(self):
|
||||||
username = self.options.username
|
username = self.options.username
|
||||||
password = self.options.password
|
password = self.options.password
|
||||||
if not username and not password:
|
|
||||||
if config.values.svn.username and config.values.svn.password:
|
# We'll get the username, password pair from a configuration
|
||||||
self.authInfo = (config.values.svn.username,
|
# file from users home directory. Currently we need user to
|
||||||
config.values.svn.password)
|
# give it from the user interface.
|
||||||
return
|
# if not username and not password:
|
||||||
elif username and password:
|
# if someauthconfig.username and someauthconfig.password:
|
||||||
|
# self.authInfo = (someauthconfig.username,
|
||||||
|
# someauthconfig.password)
|
||||||
|
# return
|
||||||
|
if username and password:
|
||||||
self.authInfo = (username, password)
|
self.authInfo = (username, password)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
+13
-14
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- conding: utf-8 -*-
|
||||||
|
|
||||||
# PISI Configuration File module, obviously, is used to read from the
|
# PISI Configuration File module, obviously, is used to read from the
|
||||||
# configuration file. Module also defines default values for
|
# configuration file. Module also defines default values for
|
||||||
# configuration parameters.
|
# configuration parameters.
|
||||||
@@ -13,9 +15,11 @@
|
|||||||
#CFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
|
#CFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
|
||||||
#CXXFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
|
#CXXFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
|
||||||
#
|
#
|
||||||
#[svn]
|
#[dirs]
|
||||||
#username = caglar
|
#lib_dir = /var/lib/pisi
|
||||||
#password = isteoylebirsey
|
#db_dir = /var/db/pisi
|
||||||
|
#archives_dir = /var/cache/pisi/archives
|
||||||
|
#tmp_dir = /var/tmp/pisi
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from ConfigParser import ConfigParser, NoSectionError
|
from ConfigParser import ConfigParser, NoSectionError
|
||||||
@@ -43,9 +47,12 @@ class DirsDefaults:
|
|||||||
archives_dir = "/var/cache/pisi/archives"
|
archives_dir = "/var/cache/pisi/archives"
|
||||||
tmp_dir = "/var/tmp/pisi"
|
tmp_dir = "/var/tmp/pisi"
|
||||||
|
|
||||||
class SvnDefaults:
|
# bu bilgiyi burada tutmak mantıklı değil. bunun yerine kullanıcının
|
||||||
"""Default values for [svn] section """
|
# kendi ev dizininde ayrı bir dosyada tutmak gerekiyor. Şimdilik bunu
|
||||||
username = password = None
|
# desteklemeyelim. Sonra hallederiz...
|
||||||
|
# class SvnDefaults:
|
||||||
|
# """Default values for [svn] section """
|
||||||
|
# username = password = None
|
||||||
|
|
||||||
class ConfigurationSection(object):
|
class ConfigurationSection(object):
|
||||||
"""ConfigurationSection class defines a section in the configuration
|
"""ConfigurationSection class defines a section in the configuration
|
||||||
@@ -59,8 +66,6 @@ class ConfigurationSection(object):
|
|||||||
self.defaults = BuildDefaults
|
self.defaults = BuildDefaults
|
||||||
elif section == "directories":
|
elif section == "directories":
|
||||||
self.defaults = DirsDefaults
|
self.defaults = DirsDefaults
|
||||||
elif section == "svn":
|
|
||||||
self.defaults = SvnDefaults
|
|
||||||
else:
|
else:
|
||||||
e = "No section by name '%s'" % section
|
e = "No section by name '%s'" % section
|
||||||
raise ConfigException, e
|
raise ConfigException, e
|
||||||
@@ -103,9 +108,3 @@ class ConfigurationFile(object):
|
|||||||
except NoSectionError:
|
except NoSectionError:
|
||||||
dirsitems = []
|
dirsitems = []
|
||||||
self.dirs = ConfigurationSection("directories", dirsitems)
|
self.dirs = ConfigurationSection("directories", dirsitems)
|
||||||
|
|
||||||
try:
|
|
||||||
svnitems = parser.items("svn")
|
|
||||||
except NoSectionError:
|
|
||||||
svnitems = []
|
|
||||||
self.svn = ConfigurationSection("svn", svnitems)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user