Re: [Zope] zeopack: No handlers could be found for logger "ZEO.zrpc"
Thanks for the help. Adding the following (as suggested) resolved the problem: import logging logging.basicConfig() Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] zeopack: No handlers could be found for logger "ZEO.zrpc"
When I run the following: python /usr/lib/zope/bin/zeopack.py -d 20 -h localhost -p 8100 I get an error: No handlers could be found for logger "ZEO.zrpc" I have searched around and found a similar message at http://mail.zope.org/pipermail/zope-dev/2005-December/026097.html (relating to zeoup.py) but I didn't understand what needs to be done to remedy the problem. In the case of zeopack, the database is not packed i.e. the script doesn't work. I am running Zope 2.8.2 with python 2.4.1. Any help would be appreciated. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] MySql 5.0, ZMySQLDA and stored procedures
I was getting the following error when attempting to call a stored procedure via a Z SQL Method: _mysql_exceptions.OperationalError: (1312, etc So I made the following change to /usr/lib/zope/lib/python/Products/ZMySQLDA/db.py: def _parse_connection_string(self, connection): kwargs = {'conv': self.conv, 'client_flag': 65536 #inserted by CSB } I then restarted Zope. I can now successfully call stored procedures. There may be a better way to do it. Feel free to advise if so. Apologies if this information has already been posted. Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] List within a list - how to use in a page template
David H wrote: # python script # input: a tuple named tup of index items to include in list of lists, eg (1,3) and the list of lists #example input: listoflists = [[61282125371L, 1, 6, 0], [61282125379L, 1, 6, 0], [61282825240L, 6, 6, 0]] #example tup: (1,3) ret = [] for i in range(len(listoflists)): if i in tup: ret.append(x[i]) return ret Hmmm, I'd hypothesise that whatever is returning that list of lists is what needs to change :-S Thanks. I'm using a web service which returns the list. I resolved the problem by iterating through the returned list and populating a new list. I'm sure there's a better way, I just couldn't figure it out. Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Unauthorized exception when trying to access a list item
Cameron Beattie wrote: I am trying to access a value in a list. The script getDIDS_list is passed a list called listoflists: list = listoflists ret = [] tup = (0,1,2) factortup = (1,2) factor = 2 for i in range(len(list)): # 1 == 1 if i in tup: if i in factortup: x = list[i] * factor etc The code is a bit strange due to my testing. However zope gets upset when trying to evaluate list[i]: You are not allowed to access '1' in this context Whats in your list? A protected item? Does this happen everytime or just with '1'? David The list consists of something like this: [61282125371L, 1, 6, 0]. It happens whatever element I try to access. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Unauthorized exception when trying to access a list item
I am trying to access a value in a list. The script getDIDS_list is passed a list called listoflists: list = listoflists ret = [] tup = (0,1,2) factortup = (1,2) factor = 2 for i in range(len(list)): # 1 == 1 if i in tup: if i in factortup: x = list[i] * factor etc The code is a bit strange due to my testing. However zope gets upset when trying to evaluate list[i]: You are not allowed to access '1' in this context a.. Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: context.getDIDS_list(listoflists = DIDs) a.. Module Python expression "context.getDIDS_list(listoflists = DIDs)", line 1, in a.. Module Shared.DC.Scripts.Bindings, line 311, in __call__ a.. Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec a.. Module Products.PythonScripts.PythonScript, line 323, in _exec a.. Module None, line 10, in getDIDS_list Line 10 a.. Module AccessControl.ZopeGuards, line 71, in guarded_getitem a.. Module AccessControl.ImplPython, line 529, in validate a.. Module AccessControl.ImplPython, line 329, in validate I've tried calling the script from the page template using here.getDIDS_list, container.getDIDS_list context.getDIDS_list but the problem persists. Am I accessing the list in the wrong way? Any advice would be appreciated. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] List within a list - how to use in a page template
I am trying to get my head around representing a list in a page template. Assume the following list: m [[61282125371L, 1, 6, 0], [61282125379L, 1, 6, 0], [61282825240L, 6, 6, 0], [61282125378L, 1, 6, 0], [61282125374L, 1, 6, 0] m[0] [61282125371L, 1, 6, 0] m[0][0] 61282125371L i.e. m is a list where each member is itself a list. How do I get a page template to render a particular item? Assume a function getem returns the list. This code will produce four columns and five rows, with each populated by the list members. But what if I only want the first and third members in each case i.e. 2 columns and five rows? I thought it would be something like tal:content="python:single[0]" but that gives me an unsubscriptable object error. Any suggestions would be appreciated. Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Finding a match in a large dataset - btrees?
Thanks for the many replies. I apologise for the original message which was obviously very unclear - I will try to correct that. Basically I want to match a telephone number to a rate table. Assume the following rate table: Telephone codeRate 6491 64212 64222.5 64 1.5 The following table sets out the appropriate rate to return for a given telephone number Dialled numberReturned rate 649123 1 6431231.5 6422 64221 2.5 Things to note: If there is no match the right-most digit is removed until there is a match e.g. 643123 matches to 64 The length of the "dialled number" is not consistent e.g. 649123 vs 64221 The length of the "telephone code" is not consistent e.g. 64 vs 6422 I want to do this frequently and at low cost i.e. ideally in memory. Perhaps the best way is to write a procedure in MySQL however I am interested in any python-based alternatives. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Finding a match in a large dataset - btrees?
I have a large set of data (that will be stored in MySQL) that I wish to match to and am wondering what the best method is. Assume the following data in table LOCATION_MATCH: LOCATION_IDLOCATION_PATTERNPARENT_ID 106 11410 13211 12911 14113 15213 The string 6438 should return 11, 6421 14, 6422 15 and 6499 12. I've read a bit about btrees on the zope wiki and wonder if that's the best way. However I am struggling with the basics: 1. How do I get the data from MySQL into a btree in Zope? Something like: from BTrees.IIBTree import * t = IIBTree() t.update(context.select_from_LOCATION_MATCH) # errr, no 2. How do I find the matching node i.e. when I want to know that 6422 relates to location_id 15? Any help or pointers to further documentation would be appreciated. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Issues with pyperl: perl2.so not found
On 11/3/05, Cameron Beattie <[EMAIL PROTECTED]> wrote: pyperl is a prerequisite to zoperl which allows perl scripts to be used within zope. I should have mentioned that. Try the zope-perl@zope.org, if it still exists... Thanks. Will do. zoperl hasn't been updated since 2001. That's probably more due to nobody using it than being perfect. The reason for that is that Zope a>lready has a very good scripting language, so the need to use perl is very miniscule, and almost always more pain than it's worth. I'm very happy with Zope and python. Unfortunately my bank doesn't have a python version of it's API which is why I'm trying to use perl with Zope. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Issues with pyperl: perl2.so not found
pyperl is a prerequisite to zoperl which allows perl scripts to be used within zope. I should have mentioned that. Regards Cameron - Original Message - From: "Jens Vagelpohl" <[EMAIL PROTECTED]> To: "The list Zope" Sent: Thursday, November 03, 2005 10:01 PM Subject: Re: [Zope] Issues with pyperl: perl2.so not found On 3 Nov 2005, at 04:42, Cameron Beattie wrote: I am attempting to install pyperl and am having an issue where it can't find perl2.so. I think this is one of those ones where it's looking under the stairs for something which is actually in the laundry under a pile of dirty clothes. This is a Zope-related list. Can't see anything your post which has even a remote relationship with Zope. Did you post to the wrong list? jens ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Issues with pyperl: perl2.so not found
I am attempting to install pyperl and am having an issue where it can't find perl2.so. I think this is one of those ones where it's looking under the stairs for something which is actually in the laundry under a pile of dirty clothes. cd /tmp/pyperl* cd Python-Object; perl Makefile.PL; make install cd .. python setup.py install python test.py Traceback (most recent call last): File "apply.py", line 1, in ? import perl ImportError: perl2.so not found echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin find -name perl2.so ./usr/lib/python2.4/site-packages/perl2.so whereis python python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 /usr/lib/python2.3 /usr/include/python2.4 /usr/share/man/man1/python.1.gz whereis perl perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz python -V Python 2.4.1 perl -v This is perl, v5.8.6 built for i386-linux-thread-multi Obviously I've done something wrong and any clues to point me or the system in the right direction would be appreciated. Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zope security and packing the database
I have created a script based on zope_pack from the Zope book which allows a username and password to be specified when it is called. I wish to create a user specifically for this purpose that only has the ability to pack the ZODB. What permission is ZODB packing protected by? I don't know. That's part of the problem. I can't see any permissions that allow or disallow this. granted the backup role all available permissions. But the user can't login to http://mydomain.com/Control_Panel/Database/main/manage_workspace I don't know what zope_pack looks like, can you show us? vi zope_pack #!/usr/bin/python import sys, urllib host = sys.argv[1] days = sys.argv[2] user = sys.argv[3] pwd = sys.argv[4] class MyUrlOpener(urllib.FancyURLopener): def prompt_user_passwd(self, host, realm): return (user,pwd) def __init__(self, *args): self.version = "Zope Packer" urllib.FancyURLopener.__init__(self, *args) def main(): urllib._urlopener = MyUrlOpener() url = "%s/Control_Panel/Database/manage_pack?days:float=%s" % \ (host, days) try: f = urllib.urlopen(url).read() except IOError: print "Cannot open URL %s, aborting" % url print "Successfully packed ZODB on host %s" % host if __name__ == '__main__': main() What error message do you get? If I use a user that has the Owner role it works correctly. If I use the backup user then urllib can't get the url due to no authentication so errors as follows: File "/usr/lib/python2.4/urllib.py", line 180, in open return getattr(self, name)(url) File "/usr/lib/python2.4/urllib.py", line 305, in open_http return self.http_error(url, fp, errcode, errmsg, headers) File "/usr/lib/python2.4/urllib.py", line 318, in http_error result = method(url, fp, errcode, errmsg, headers) File "/usr/lib/python2.4/urllib.py", line 615, in http_error_401 return getattr(self,name)(url, realm) File "/usr/lib/python2.4/urllib.py", line 628, in retry_http_basic_auth return self.open(newurl) Any tracebacks? Nothing appears in the log. PS: I wouldn't do zodb packing by whacking a url. There's a script that scripts with ZOpe now that opens up a ZEO connection and does the pack that way, that's what I'd do... I don't use ZEO - can I just do the scripted packing bit without all the associated ZEO setup? Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Zope security and packing the database
I have created a script based on zope_pack from the Zope book which allows a username and password to be specified when it is called. I wish to create a user specifically for this purpose that only has the ability to pack the ZODB. I've created a custom role and a user that has this role. Then I went to http://mydomain.com/Control_Panel/Database/main/manage_access and granted the backup role all available permissions. But the user can't login to http://mydomain.com/Control_Panel/Database/main/manage_workspace in order to pack the database. Obviously I'm missing something very fundamental here. Could anyone point me in the right direction please? Regards Cameron ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )