Jump to content
Froxlor Forum
  • 0

[HOWTO]resolve DeprecatedWarnings in pyzor (under construction)


Chaos234

Question

#####IMPORTANT HINT#####

This HowTo is still under construction and should be used after it's finished!

If you make the changes before this HowTo is finished, You can get many error's at You shell and the system can be damaged instandly.

 

I don't give any safty for work because it's my first modification on .py-Scripts.

 

The HowTo will be finished tomorrow 0:00am (28th June 2012) or later because I must test all changes before releasing this HowTo to You.

 

@Admin, Mods, Dev's:

 

Don't close ore delte this Topic befor ore after it's finished. If You finde any mistakes at this moment, still send me a pm (if you can write german, please do so ;))

with the mistake.

#####IMPORTAN HINT END#####

 

At this Thread http://forum.froxlor...ettings-plugin/ you can install spamassassin as module to froxlor.

 

But if you execute the Step 13:

 

13) login as user vmail and run the following commando's:
razor-admin -d -register
pyzor discover

 

The commondline would give you to error's/hints:

 

by "razor-admin -d -register": no homedir defined (I don't know the real msg any more, but this defines very well).

 

To resolve this problem I used google an found a reason to solve it:

 

13) as root-user do following cmd on the shell:
usermod -d /var/customer/mail vmail
(now /var/customer/mail is vmail's homedir)

 

Then you can exec "razor-admin -d -regitser.

 

Now the Problem with "pyzor-discover":

 

There're two problems to solve:

 

- module sha is depricated

- module multifile is depricated

 

This means you've to edit your __init_.py and your client.py.

 

####WARNING####

 

Befor you exec the steps below make sure you've a backup from the old one ore try a other workaround.

 

####WARING END####

 

Step 1 (file /usr/lib/pymodules/python2.6/pyzor/__init__py):

 

### <<< My use for single-line-comments in the CODE-Block

/* ... */ <<< My use for multi-line-comments in the CODE-Block

 

###Do the following as root-user in a shell (putty for windows)###
nano (or vi) /usr/lib/pymodules/python2.6/pyzor/__init__.py

###Now we edit at first the __author__, __version__ and __revision__###

/*
* search for __author__, __version__ and __revision__ and replace
* it with the following data
*/

__author__   = "Frank J. Tobin, ftobin@neverending.org & Marcel Petzold marcel@gnex.org"
__version__  = "0.5.1 beta 1"
__revision__ = "$Id: __init__.py,v 1.44 beta 1 2012-06-27 03:47:30 ftobin Exp $"

/*
* I've set the new version to beta-release because I don't know how it works on other distris as on debian squeeze
*
* Well, now weg go to edit the improted modules. Simpel replace all "import <Module>" with the lines below
*/

import os
import os.path
import re
import sys
#import sha <<< depricated using hashlib module below this line
import hashlib
import tempfile
import random
import ConfigParser
import rfc822
import cStringIO
import time

/*
* After this, we went to line 115 (114 befor adding "import hashlib"). You see the class DataDigset(str) and there is a use of the
* depricated module sha. Now You only need to copy&past the following source after "class DataDigest(str):" and between def __init__(self, value):
*/

# hex output doubles digest size

# commented because sha is depricated
#value_size = sha.digest_size * 2

# try a workaround for depricated sha module
# using var m for m = hashlib.md5()
m = hashlib.md5()
value_size = m.digest_size * 2

/*
* Well, if You're at this step, You only try to search "sha" and replace it with "hashlib" so that on line 295, 305 and 326 the following is to see:
*/

line 295: return hashlib.new(str(msg))
line 305: return hashlib.new("%s:%x" % (Username, key)).hexdigest().lower()
line 326: return hashlib.new("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()

###This is all to modify the __init__.py###

 

Now we've to edit the "client.py on "/usr/lib/pymodules/python2.6/pyzor/":

 

Step 2 (file /usr/lib/pymodules/python2.6/pyzor/client.py)

 

### <<< My use for single-line-comments in the CODE-Block

/* ... */ <<< My use for multi-line-comments in the CODE-Block

 

###Do the following as root-user in a shell (putty for windows)###

nano (or vi) /usr/lib/pymodules/python2.6/pyzor/client.py

###Now we replace all import <Modules> with the list below###

import re
import os
import os.path
import socket
import signal
import cStringIO
import getopt
import tempfile
import mimetools
#import multifile <<< depricated
#import sha <<< deprecated useing the hashlib module below this line
import hashlib

/*
* After this, we've to search for sha and simple replace it with hashlib.
* Now Your lines must be looking like the lines below:
*/

406: salt = saltfile.read(hashlib.digest_size)
409: salt_digest = hashlib.new(salt)
411: pass_digest = hashlib.new()

/*
* Well done. Now we've to solve the Problem with the multifile module wich is used in the class rcf822BodyCleaner(BasicIterator):
* If we look at this class, we can see, that we've to rewirte them. Very badly to write an completly new class, but shit happends 
*
* Ok, replace the old class with the new class.
*/


###Now we'are finaly at the and of all modifycations and you must only save all work. Then use the cmd "pyzor discover" and all should be run nicely.###

 

If there're any bugs or any other things happend on other Version e. g. FreeBSD or Ubuntu, please use the original files and Phyton 2.4 oer e other workaround.

 

Regards

 

Chaos234

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...