you cold do it the following way:
add this to models/db.py
import os.path
from ConfigParser import ConfigParser
class Config:
'''
to configure please use the config file that is created with this
class
under unix systems you will find it under
/home/YOURNAME/.pyMantis/plugin_mailinglist_config
'''
__borg_dict = {'parser': None}
_config_path = os.path.join(os.path.expanduser('~'), '.pyMantis')
_config_file =
os.path.join(_config_path,'plugin_mailinglist_config')
def __init__(self):
self.__dict__ = self.__borg_dict
if not self.parser:
self.parser = ConfigParser()
self.parser.add_section('smtp')
self.parser.set('smtp','server','mail.abcde.com:1234')
self.parser.set('smtp','login','user:password')
self.parser.read(self._config_file)
def get(self, section, option):
return self.parser.get(section, option).strip()
def set(self, section, option, value):
self.parser.set(section, option, value)
def write(self):
if not os.path.isdir(self._config_path):
os.mkdir(self._config_path)
self.parser.write(open(self._config_file,'w'))
plugin_mailinglist_config = Config()
plugin_mailinglist_config.write()
now you can to in you controller
host, port = plugin_mailinglist_config.get('smtp','server').split(':')
user, passw = plugin_mailinglist_config.get('smtp','login').split(':')
On May 28, 1:34 pm, scausten <[email protected]> wrote:
> I'm implementing PayPal on my site and would like to know the best
> practice for securely storing my API credentials (user, pass,
> signature).
>
> Can this go in the database (say in a 'credentials' table), or should
> it be elsewhere?