Ok, I didn't want to get into this too much, but the way I'm using tmda-cgi
is not in a standard environment. So there might be some things I say that
seem kinda weird.
When a user logs into tmda-cgi, they use their whole email address (ie.
[EMAIL PROTECTED]). Every user shares a common tmda config file that
automatically makes all the settings based on their login name/domain. For
example, some of the lines are like this:
ADDED_HEADERS_CLIENT = {"X-Primary-Address": user + "@" + domain}
CONFIRM_APPEND = os.path.join(userdir, "lists/confirmed")
PENDING_BLACKLIST_APPEND = os.path.join(userdir, "lists/blacklist")
PENDING_WHITELIST_APPEND = os.path.join(userdir, "lists/whitelist")
FULLNAME = user + "@" + domain
BOUNCE_ENV_SENDER = user + "-" + "confirmbounce@" + domain
DELIVERY = user + "@" + domain
Now, I can get the user name from a variable that is stored off into the
environment, but if I login as [EMAIL PROTECTED], all I can get is
"johndoe". I need to be able to get the whole login so that I can set the
user and domain variables above as so:
login = string.lower(os.environ['LOGIN'])
user, domain = login.split('@')
As just a quick hack (this is all in testing), I've added:
--- ../tmda-cgi-0.11/Session.py 2003-06-14 10:52:10.000000000 -0400
+++ Session.py 2003-08-15 18:54:47.000000000 -0400
@@ -214,6 +214,7 @@
self.NoOverride[Option] = self.ThemeVars.get("NoOverride", Option, 1)
# Trim out domain name from user name
+ os.environ["LOGIN"] = self.Vars["User"]
Match = re.search(self[("NoOverride", "UserSplit")], self.Vars["User"])
if Match:
os.environ["USER"] = Match.group(1)
At this time, this is the only thing that I need to retrieve (LOGIN and
NAME). I couldn't figure out how to do it any other way. I don't have a
general need to grab random variables. Is this an acceptable way to handle
it?
As far as them not always being available, I know this... What I have posted
here is very simplified, as it's really only used when called by tmda-cgi,
not when used by, for example, tmda-filter.
Let me know if you need more information.
"Gre7g Luterman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Fri, 15 Aug 2003 03:12:44 -0600, "Bernard Johnson"
<[EMAIL PROTECTED]> wrote:
> Is it possible to get the information retrieved from the virtual-lookup
> script and use it in the users config file? For example, if I wanted to
get
> what is retrieved in the Session.py's self.Vars["NAME"], how would I
> reference this in the users .tmda/config?
Erf. There really isn't a way currently. Is there a need for me to
add this?
Keep in mind that even if I somehow provide variables from Session.py
to config, they will not always be available. config is not only run
by tmda-cgi. If you rely on a value being there, you might be
disappointed at other times (like when you receive mail).
What do you have in mind?
Gre7g.
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers