[Zope] Plenty of problems. Please Help

Michel Pelletier michel@digicool.com
Fri, 5 Mar 1999 09:48:24 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------ =_NextPart_000_01BE6717.3B426460
Content-Type: text/plain



> -----Original Message-----
> From: Pavlos Christoforou [mailto:pavlos@gaaros.msrc.sunysb.edu]
> Sent: Friday, March 05, 1999 5:47 AM
> To: zope@zope.org
> Subject: [Zope] Plenty of problems. Please Help
> 
> 
> Zopistas
> 
> I have encountered problems mainly associated with ZServer and ZAP:
> 
> I am using Zope-1.9.0 and the preconfigured Apache server to 
> run my Zope
> site. Last night (a couple of hours ago!) I installed 
> ZServer. It wouldn't
> run and I had to add the following to start.py to fix it:
> 
I would suggest, first off, to use 1.10.2.  ZServer is being developed
against 1.10.2, and the latest Zap was tested and confirmed to work with
it.

> import sys,os
> sys.path.insert(0,os.path.join('..','lib','python'))
> 

Yes, there were discussions on this in the list about this problem.
Someone needs to go back, rassle up the discussion and submit it to the
ZDP.  Looks like you found the fix.

> Later on upon entering the management screens I noticed that 
> the id of the
> top level folder dissappeared which caused the paths to my objects to
> change. With ZAP (the preconfigured apache) I would visit:
> http://www.gaaros.com:8080/Gaaros/ to get to the top level 
> directory but
> with ZServer is: http://www.gaaros.com:8080/ which spoils all kind of
> links that people have on my site.

Hm.  Is your Zap .pcgi file named Garros or does your RewriteRule look
for Garros and then call PCGI?  If so that is why you need to use Garros
to reach the server.  ZServer can server right out of Zope and doesn't
have this problem.  Your description makes this sould like it is a
production site, I would not suggest running ZServer on a production
machine as it is alpha and still buggy.

> 
> Switching back to ZAP I got the following error:
> 
>   <FONT SIZE="+2">Temporarily Unavailable</FONT>
>   <P>
>   The resource you requested is temporarily unavailable - 
> please try again
> later.
>   </TD>
> </TR>
> </TABLE>
> (102) failure during connect
> <!--
> No such file or directory
> pcgi-wrapper-version 2.0a5
> -->
> </BODY></HTML>  
> 
> Seems like ZServer changed my root id from "Gaaros" to nothing.

This error comes from PCGI.  It can't find your .cgi file so Zope isn't
even being launched.  Did your zap.conf file change (specificly the
RewriteRule)?

> I called PickleDictionary on Data.bbb directly from python 
> but I could not
> even see the subobjects. BTW can the Zope Data.bbb be 
> accessed directly
> from PickleDictionary??
> 

You can open a Data.bbb file into a PickleDictionary, but you won't see
anything useful unless you really know what your doing.  The Database
itself is not a Pickle, it is a database of Pickles.  I have attached a
small 5K script that will be released with 1.10.3 which paruses the
database and generates reports.  In the future we are intending it to
translate the entire database into XML for transport. (Note, we do not
intend to use XML as the db format)

> Also trying to shut ZServer from the control-panel results in 
> a core dump.
> 

I suspect this is because you are using 1.9.0

> Ok enough for now, its very late and I cannot think anymore.
> 
> If anybody has any clues about the root object id problem 
> please let me
> know.
> 
> Thanks
> 
> Pavlos 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 


------ =_NextPart_000_01BE6717.3B426460
Content-Type: application/octet-stream;
	name="bbb.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bbb.py"

"""Read and (re-)format BoboPOS 2 database files=0A=
"""=0A=
=0A=
import struct, string, sys, time=0A=
=0A=
file__version__=3D3.0=0A=
packed_version=3D'SDBMV'+struct.pack(">f",file__version__)=0A=
=0A=
def error(message, fatal=3D0, exc=3D0):=0A=
    if exc:=0A=
        sys.stderr.write('%s: %s' % (sys.exc_info()[0], =
sys.exc_info()[1]))=0A=
    sys.stderr.write("\n%s\n" % message)=0A=
    if fatal: sys.exit(fatal)=0A=
=0A=
def _read_and_report(file, rpt=3DNone, fromEnd=3D0, both=3D0, =
n=3D99999999, show=3D0):=0A=
    """\=0A=
    Read a file's index up to the given time.=0A=
    """=0A=
=0A=
    file.flush()=0A=
    seek=3Dfile.seek=0A=
    read=3Dfile.read=0A=
    unpack=3Dstruct.unpack=0A=
    split=3Dstring.split=0A=
    join=3Dstring.join=0A=
    find=3Dstring.find=0A=
    seek(0,2)=0A=
    file_size=3Dfile.tell()=0A=
    gmtime=3Dtime.gmtime=0A=
=0A=
    if fromEnd: pos=3Dfile_size=0A=
    else:       pos=3Dnewpos=3Dlen(packed_version)=0A=
     =0A=
    tlast=3D0=0A=
    err=3D0=0A=
    while 1:=0A=
        if fromEnd:=0A=
            seek(pos-4)=0A=
            l=3Dunpack(">i", read(4))[0]=0A=
            if l=3D=3D0:=0A=
                b=3Dpos=0A=
                p=3Dpos-4=0A=
                while l=3D=3D0:=0A=
                    p=3Dp-4=0A=
                    seek(p)=0A=
                    l=3Dunpack(">i", read(4))[0]=0A=
=0A=
                pos=3Dp+4=0A=
                error("nulls skipped from %s to %s" % (pos,b)) =0A=
            p=3Dpos-l=0A=
            if p < 0:=0A=
                error('Corrupted data before %s' % pos)=0A=
                if show > 0:=0A=
                    p=3Dpos-show=0A=
                    if p < 0: p=3D0=0A=
                    seek(p)=0A=
                    p=3Dread(pos-p)=0A=
                else:=0A=
                    p=3D''=0A=
                error(p,1)=0A=
            pos=3Dp=0A=
        else:=0A=
            pos=3Dnewpos=0A=
=0A=
        seek(pos)=0A=
        h=3Dread(24) # 24=3Dheader_size=0A=
        if not h: break=0A=
        if len(h) !=3D  24: break=0A=
        oid,prev,start,tlen,plen=3Dunpack(">iidii",h)=0A=
        if (prev < 0 or prev >=3D pos or start < tlast=0A=
            or plen > tlen or plen < 0 or oid < -999):=0A=
            __traceback_info__=3Dpos, oid,prev,start,tlen,plen=0A=
            error('Corrupted data record at %s' % pos)=0A=
            if show > 0: error(read(show))=0A=
            err=3D1=0A=
            break=0A=
=0A=
=0A=
        newpos=3Dpos+tlen=0A=
        if newpos > file_size:=0A=
            error('Truncated data record at %s' % pos)=0A=
            if show > 0: error(read(show))=0A=
            err=3D1=0A=
            break=0A=
=0A=
        seek(newpos-4)=0A=
        if read(4) !=3D h[16:20]:=0A=
            __traceback_info__=3Dpos, oid,prev,start,tlen,plen=0A=
            error('Corrupted data record at %s' % pos)=0A=
            if show > 0:=0A=
                seek(pos+24)=0A=
                error(read(show))=0A=
            err=3D1=0A=
            break=0A=
=0A=
        tlast=3Dstart-100=0A=
=0A=
        if rpt is None: continue=0A=
        n=3Dn-1=0A=
        if n < 1: break=0A=
=0A=
        seek(pos+24)=0A=
        p=3Dread(plen)=0A=
        t=3Dsplit(read(tlen-plen-28),'\t')=0A=
        tname, user =3D (t+[''])[:2]=0A=
        t=3Djoin(t[2:],'\t')=0A=
        start,f=3Ddivmod(start,1)=0A=
        y,m,d,h,mn,s=3Dgmtime(start)[:6]=0A=
        s=3Ds+f=0A=
        start=3D"%.4d-%.2d-%.2d %.2d:%.2d:%.3f" % (y,m,d,h,mn,s)=0A=
        rpt(pos, oid,start,tname,user,t,p)=0A=
=0A=
    if err and both and not fromEnd:=0A=
        _read_and_report(file, rpt, 1, 0, n, show)=0A=
=0A=
=0A=
=0A=
def none(*ignored): pass=0A=
def positions(pos, *ignored): sys.stdout.write("%s\n" % pos)=0A=
def tab_delimited(*args):=0A=
    sys.stdout.write("%s\n" % string.join(args[:-1],'\t'))=0A=
=0A=
=0A=
reports=3D{=0A=
    'none': none,=0A=
    'positions': positions,=0A=
    'tab_delimited': tab_delimited,=0A=
    }=0A=
=0A=
if __name__=3D=3D'__main__':=0A=
    import getopt=0A=
=0A=
    usage=3D"""Usage: %s [options] filename=0A=
=0A=
    where filename is the name of the database file.=0A=
=0A=
    options:=0A=
=0A=
       -r report=0A=
=0A=
          Specify an output report.=0A=
=0A=
          The valid reports are:=0A=
		%s=0A=
=0A=
       -e=0A=
=0A=
          Read the file from back to front=0A=
=0A=
       -l n=0A=
=0A=
          Show only n records=0A=
=0A=
       -b=0A=
=0A=
          If an error is encountered while reading from front,=0A=
          ret reading from the back.=0A=
=0A=
       -s n=0A=
=0A=
          If a corrupted data record is found, show the first n=0A=
          bytes of the corrupted record.=0A=
          =0A=
    """ % (sys.argv[0], string.join(reports.keys(), ',\n\t\t'))=0A=
=0A=
    try:=0A=
        opts, args =3D getopt.getopt(sys.argv[1:],'r:ebl:s:')=0A=
        filename,=3Dargs=0A=
    except: error(usage,1,1)=0A=
    =0A=
    rpt=3Dnone=0A=
    fromEnd=3D0=0A=
    both=3D0=0A=
    n=3D99999999=0A=
    show=3D0=0A=
    for o, v in opts:=0A=
        o=3Do[1:]=0A=
        if o=3D=3D'r':=0A=
            try: rpt=3Dreports[v]=0A=
            except: error('Invalid report: %s' % v, 1)=0A=
        elif o=3D=3D'l':=0A=
            try: n=3Dstring.atoi(v)=0A=
            except: error('The number of records, %s, shuld ne an =
integer'=0A=
                          % v, 1)=0A=
        elif o=3D=3D's':=0A=
            try: show=3Dstring.atoi(v)=0A=
            except: error('The number of bytes, %s, shuld ne an =
integer'=0A=
                          % v, 1)=0A=
        elif o=3D=3D'e':=0A=
            fromEnd=3D1=0A=
        elif o=3D=3D'b':=0A=
            both=3D1=0A=
        else:=0A=
            error('Unrecognized option: -%s' % o, 1)=0A=
=0A=
    try: file=3Dopen(filename)=0A=
    except: error('Coud not open %s' % filename,1,1)=0A=
=0A=
    _read_and_report(file, rpt, fromEnd, both, n, show)=0A=
=0A=
            =0A=
    =0A=
=0A=
=0A=
=0A=
=0A=

------ =_NextPart_000_01BE6717.3B426460--