Re: [Zope-dev] Accept-Charset hearders causing 500 internal servererror.[correct but not lenient]

2003-02-11 Thread Juan David Ibáñez Palomar

The bug was fixed three weeks ago (branch-1-0), it is
time for a release I guess. Well, only the strip(),
no try/except clause yet.

By the way, Localizer bugs/patches should be sent to
the Localizer mailing list or to the SourceForge tracker
of the LLEU project.


Romain Slootmaekers wrote:


Romain Slootmaekers wrote:
Hi,
below the original post:

it is a bug in Products/Localizer/Accept.py

here's the code to fix it:

#--- code fix starting from line 102 ---


# Get the quality
try:
if len(x) == 2:
quality = x[1]# Get the quality
quality =quality.strip()
quality = quality[2:] # Get the number (remove 
q=)
quality = float(quality)  # Change it to float
else:
quality = 1.0
except:
quality=1.0
#--- end of code fix ---

I added a strip() and a try/except for other things that can go wrong.

This way Nokia Wap surfers can access your site while Localizer is 
installed.

have fun,

Sloot.

BTW, exceptions that originate here are not caught in the error_log.
this is probably unintended as well.


- original post -

Hi,

We have problems with the Accept-Charset headers that are sent to the 
zope server by some mobile phones:
fi:
'Accept-Charset':'ISO-8859-1, US-ASCII, UTF-8; Q=0.8'

These cause a 500 internal server error. (Error Value: invalid 
literal for float(): =0.8 )

I checked with the HTTP1.1 RFC26160 section 14.2 and the header seems 
valid, but in fact isn't:
there is a space between the semi-colon and the Q char (which 
shouldn't be there acoording to the spec).

So, in principle, this is not a zope server bug, but an inflexibility.

I think the server should be a bit more lenient.
a simple .strip() in the right place should do.

Could you guys fix this?

TIA,

Sloot.




BTW, for completeness, I included a quick test program is included 
below (causes a 500 on my zope 2.6.0) :



#- program illustrating the behavior ---
import httplib, urllib

def sendHTTP():



headers = {'Accept':
   'application/vnd.wap.wmlc, 
application/vnd.wap.wmlscriptc, application/vnd.wap.wbxml, 
image/vnd.wap.wbmp, image/gif, application/*, text/html, 
application/xhtml+xml, application/vnd.wap.wml+xml, text/css',
   'Accept-Charset':'ISO-8859-1, US-ASCII, UTF-8; 
Q=0.8'}#, ISO-10646-UCS-2; Q=0.6'
conn = httplib.HTTPConnection(127.0.0.1:8080)
conn.request(GET, /mobile/wap/games/,headers=headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
print data

conn.close()

sendHTTP()




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )





___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )




--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] my comments on i18n

2001-12-04 Thread Juan David Ibáñez Palomar

Joachim Werner wrote:

Hi!

Just a very short comment:

As Paul said in the Paris meeting and as Joachim W. has
stated in a previous mail, one thing we can work on is in
a common way to get translations from message catalogs, from
Python code and DTML and ZPT templates.


exactly

Don't matters where the messages and their translations are
stored, either in a ZBabel Tower or in a Message Catalog
or somewhere else, they would be get in the same way.


yep

I would propose to do it in a wiki and step by step: first Python
code, when have finished with it we move to DTML, and finally
to ZPT.


My priorities are the other way around, but that shouldn't be the problem
...


I think the Python API is simpler, and the DTML and ZPT interfaces build
on it, so it should be done first.

But then we could work on the DTML and ZPT interfaces at the same time.



The output from this would be an specification for the way to
get translations from message catalogs in the ZODB.


yep

My second concrete proposal is about content negotiation, which
includes language negotiation. There's already a proposal for
this in the fishbowl:

   http://dev.zope.org/Wikis/DevSite/Proposals/HTTPContentNegotiation

This proposal was made by Andreas Jung and Tino Wildenhain, let's
move it forward. IMO this should be the first thing to put in the
core.


We don't have anything sophisticated there. So we are very open to those
things.


With the last news about Zope 3 it seems that all core proposals should be
revised under its light. So I'll add the task learn Zope 3 in my 
queue. I only
wanted to highlight that this is something important.


But this is also something we can work on from the ZBabel/Localizer/etc..
perspective. I mean, now it's a bit difficult to mix different solutions 
in the
same web site because, if each solution has a different way to do the 
language
negotiation, it could produce a nasty result, for example, ZBabel returns
something in german and Localizer returns something else in spanish.

At least we could agree on the same algorithm to build the list of user
prefered languages.

Ummhh... We can do some work here. But I prefer to do things in small
steps, lets focus on the message catalogs interface first.


Concerning the Wiki: Why not go on using the Wiki Stephane Fermigier has set
up for us?


Ok, I've added a wiki page for this task, though it's still empty, for 
those who
don't know the url is:

  http://www.eurozope.org/zip


-- 
J. David Ibáñez, Nuxeo.com
Zope developer (http://www.zope.org)




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] PluginIndexes, 2 bugs

2001-11-27 Thread Juan David Ibáñez Palomar


First bug, the module 'Products/PluginIndexes/tests/testFieldIndex.py'
contains the methods 'checkEmpty', 'checkPopulated', 'checkZero',
'checkNone' and 'checkRange'; they should be named 'testEmpty',
'testPopulated', etc.. otherwise the tests doesn't run.


Last bug, The file 'Products/PluginIndexes/README.txt' from Zope 2.4.3
says that there're two ways to pass parameters:

   old: dtml-in myCatalog(myindex='xx yy',myindex_usage':'blabla')
   new: dtml-in myCatalog(myindex={'query':'xx yy','usage':''})

And the class 'CatalogTool' in 'Products/CMFCore/CatalogTool.py'
(CMF from the CVS) uses the new way, but it doesn't works.

Add the following test case to'PluginIndexes/tests/testFieldIndex.py':

 def testNewRange(self):
 Test a range search
 index = FieldIndex( 'foo' )
 for i in range(100):
 index.index_object(i, Dummy(i%10))

 r=index._apply_index({'foo': {'query': [-99, 3],
   'usage': 'range:min:max'}})

 assert tuple(r[1])==('foo',), r[1]
 r=list(r[0].keys())

 expect=[
 0, 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33,
 40, 41, 42, 43, 50, 51, 52, 53, 60, 61, 62, 63, 70, 71, 72,
 73, 80, 81, 82, 83, 90, 91, 92, 93
 ]

 assert r==expect, r

This test is similar to 'testRange' but uses the new way to pass
parameters. It fails:

   AssertionError: [3, 13, 23, 33, 43, 53, 63, 73, 83, 93]


-- 
J. David Ibáñez, Nuxeo.com


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Small bug in DTMLFile

2001-09-27 Thread Juan David Ibáñez Palomar


Hello,

(I think) there's a very small bug in 'App/special_dtml.py'. In Zope
2.4.1, the line 231 is:

  if bind_to in ('container', 'client'):

I think it should be:

  if bind_to in ('container', 'context'):

The problem shows when subclassing DTMLFile and trying to change the
value of _Bindings_client. The bug is also in the CVS.


jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] ANN: Localizer 0.2 released

2001-05-22 Thread Juan David Ibáñez Palomar



Hi all,

The version 0.2 of the product Localizer has been released. It helps
to internationalize/localize python products and build multilingual
web sites. The new version fixes some bugs and includes some small
new features. A little documentation is included. Download from:

  http://sourceforge.net/projects/lleu/

I'm happy to see that people is starting to use it, and it even has
been mentioned in zopezen :)

  http://www.zopezen.org/ZopeZen/SDot/990087246

Special thanks to Danny William Adair, Garikoitz Araolaza and Luistxo
Fernandez for their feedback.


jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: oodb philosophics ;) was: Re: [Zope-dev] Experiments with ORMapping

2001-05-14 Thread Juan David Ibáñez Palomar

 
  P.S.: Shane, have you developed Symlinks any further? I think they could be
  extremely useful. I tried out the initial release and liked it, except for
  the fact that the symlinks looked EXACTLY like real ones, so they can be
  very irritating ...
 
 I'm not sure what to do with symlinks.  How should security be applied? 
 How are they most useful?
 
 It's neat to see it works, though. :-)
 
 Shane
 
 

Last year I needed symlinks and developed a version of your product
where the symlink had a different id than the real object. But the
general solution of a symlink where an arbitrary set of attributes
are from the symlink instance instead of from the real object was
too much difficult for me, so this year we've changed the dessign
of the application and don't need symlinks anymore.


jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] question: which user was the last to modify an object?

2001-04-25 Thread Juan David Ibáñez Palomar



Hi all,

The undo form shows interesting info about transactions, for example their
modification times. It's easy to know the last time an object was modified
with bobobase_modification_time.

But, is there an easy way to get the name of the user that made the last
modification of an object?


thanks,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] ANN: new CalendarTag and other news

2001-04-24 Thread Juan David Ibáñez Palomar


Hi all,


I've working a little in a new CalendarTag, you can download it
(version 2.0 alpha 1) from http://sourceforge.net/projects/lleu

Be careful, its usage is somewhat different and will probably
break the pages that use the old CalendarTag. It's not for
production environments, it's mainly for getting feedback,
if there's a feature you want to see in the new Calendar Tag
let me know. Note that the new version depends on the product
mxDateTime that you can also download from the same url.


Other news, the Localizer product is updated, the version 0.1.1
fixes two bugs of the 0.1.0 version. If you're curious look at
the CVS, there you'll find an unreleased product named Content
(yes, it's not a very good name). Combining both the Localizer
and Content it will be possible to easily build big multilingual
web sites.


Best regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] ANN: mxDateTime 0.1

2001-03-31 Thread Juan David Ibáñez Palomar


Hi all,

Download mxDateTime 0.1 from 

  http://sourceforge.net/projects/lleu


README.txt
--

Introduction

  This product makes easier to use the mxDateTime python module
  from Zope. It allows to use it from Python Products and external
  methods using for example::

from Products.mxDateTime import DateTime

  It's also accessible from restricted code (DTML methods, Scripts,
  etc..) using the '_' variable, for example::

dtml-var "_.mxDateTime.today()"


How it works (read this if youd don't use a Unix like OS!!)

  When the product is initialized for the first time a symlink is
  created to the DateTime directory. If symlinks are not available
  (for example in Windows) you have to copy the whole DateTime
  directory instead.

  To make the module accessible from restricted code it has been
  needed to wrap it so it plays nice with the Zope security machinery.





Best regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Playing with DateTime

2001-03-16 Thread Juan David Ibáñez Palomar



Hello Stefano,

I used mxDateTime about two years ago, when I worked with Bobo, the
move to Zope brought lots of advantages, the only thing I missed was
mxDateTime.

The discussion about DateTime comes to the mailing lists between time
to time, you can look what has already been said about it in the
archives, for example:

  http://lists.zope.org/pipermail/zope/2000-May/108798.html
  http://lists.zope.org/pipermail/zope/2000-September/118269.html

Yes, switching to mxDateTime would require a lot of work in Zope and
also would break lots of products and web sites, while patching DateTime
is a more quick(dirty) solution.

IMHO there're no good arguments against reusing a so good piece of code,
in the long term at least; mxDateTime is the standard in the python
community, only zopers use something else; and it's free software: if
the original developer does not support it anymore others can do it.

But I understant that if you only want to fix something it's more
quick to patch DateTime.


best regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Playing with DateTime

2001-03-16 Thread Juan David Ibáñez Palomar



Hello,

Of course, we already can use mxDateTime in our own products. But
there is a problem, both modules have the same name, if you write
"import DateTime" you get the Zope's DateTime module.

A solution is to rename the mxDateTime module directory from
DateTime to, for example, mxDateTime, then use "import mxDateTime"
and everything is fine. Unfortunetaly this could break other
python programs.

I've played for several hours with imp, __import__, sys, etc.. 
but haven't been able to import mxDateTime as it's installed.
If somebody knows how to do it please let me know.

We also could build a python product (a Zope component as Brian
suggests), it would be just a copy of mxDateTime. This is not very
elegant because you could need two copies of mxDateTime, one for
the Zope and one for other python programs. And it wouldn't be so
easy to install because mxDateTime has C code that needs to be
compiled.


Another posibility is to use a symbolic link:

  $ cd INSTANCE_HOME/Products
  $ ln -s wherever the mxDateTime module is mxDateTime

And then use "from Products import mxDateTime". Windows users
still would need to copy the directory.

The (small) problem with this solution is that requires some
work of the user/admin that would be nice to avoid.

The following code automates the creation of the sym. link:

  import imp, os, string, sys
  filename = os.path.join(INSTANCE_HOME, 'Products', 'mxDateTime')
  if not os.path.isdir(filename):
  ## Find the path to the mxDateTime module
  path = filter(lambda x, find=string.find: find(x, 'zope') == -1, sys.path)
  file, pathname, description = imp.find_module('DateTime', path)
  ## Create the symlink
  os.symlink(pathname, filename)

  from Products import mxDateTime


But I still don't like this solution. If somebody comes to something better
please let me know. Improvements to that code are also very welcomed, I want
to use mxDateTime for the upcomoing new version of the CalendarTag.

Also, perhaps DC could do something to avoid the name conflict for a future
Zope release, :)


best regards,
jdavid


 
 Note the "DC needs to decide..." only applies to what we
 decide to integrate (and thus sign up to maintain, at some
 level) into the core. One of the key goals of our long-term
 strategy of becoming much more component-oriented is that
 the "marketplace" (aka the community) decides what the best
 component is for a given task.
 
 And we do not have to wait for the full component story to
 land for this to happen; as noted, I'm sure someone could
 come up with a product that "componentizes" mxDateTime in
 some way so that people who prefer it can use it easily.
 
 Time and de facto usage would then tell whether we (DC) should
 consider some sort of transition - and we can learn whether
 that would be a good idea without inconveniencing those who
 prefer to continue using the built-in DateTime in the meantime.
 
 
 
 Brian Lloyd[EMAIL PROTECTED]
 Software Engineer  540.371.6909
 Digital Creations  http://www.digicool.com
 
 

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Playing with DateTime

2001-03-15 Thread Juan David Ibáñez Palomar


Hello,

IMHO the long term solution would be to use the mxDateTime [1]
module instead of the DateTime module that currently uses Zope.


best regards,
jdavid


[1] http://www.lemburg.com/files/python/mxDateTime.html


 
 Hello
 
 I am playing around with the DateTime module in order to adapt it to other formats 
than the American one. However, I would like not to start a work that someone is 
already doing or that is already done. I have found a little patch that solves 
temporarily the problem, but I would like to do something more definitive.
 
 However, I need to be careful due to the large use that is done internally by Zope. 
To whom can I get in touch regarding this issue? 
 
 Best regards
 Stefano Vedovelli
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 
 


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] License issues

2000-11-16 Thread Juan David Ibáñez Palomar

 
 In article [EMAIL PROTECTED],
 Jimmie Houchin  [EMAIL PROTECTED] wrote:
  The GPL would protect DC from predatory competitors. It would also allow
  for Zope's adoption in certain environments. I also believe some people
 
 And prevent it in others.
 
  would relicense their products to the GPL if it were Zope's native
  license.
 
 While other products would suddently become license-incompatible.
 

I'm not going to talk now about the Zope license, as Paul requested;
by the way, thanks Paul for your message, it has been hopefully.
Instead I'll show my rationale to decide with which license I release
my software.

As Jimmie I also like copyleft licenses because they protect my work.
But the GPL is not the only copyleft license, the LGPL is too, are there
more copyleft licenses?

The GPL-incompatibility issue is a GPL issue, one way to avoid it is
not to use it. But the GPL is a widely used license, so it's important
for me not to release software with a GPL-incompatible license.

I'm not a lawyer, so I don't want to write my own license nor modify an
existing one. For now I'll stay with the LGPL beacuse it's copyleft and
doesn't has the incompatibility problems of the GPL.


There're other issues like dual-licensing or the possibly outdated concept of
library that the LGPL uses, but I wanted to keep this message as short and
clear as possible to show the fundamental issues that are important for me:
GPL-Compatibility and copyleft.


regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] License issues

2000-11-16 Thread Juan David Ibáñez Palomar

 
 On Tue, 14 Nov 2000 09:48:20 +0100 (MET), [EMAIL PROTECTED] (Juan
 David Ibáñez Palomar) wrote:
 
  it's illegal to distribute GPL code together
 with [ZPL] code
 
 I dont see this as an issue for Zope (taken as a whole). There is no
 problem with other developers releasing GPL products for Zope, as long
 as they do not create a combined distribution of Zope+TheirProduct.
 Separate rpms is enough.
 

it's important only if you want your GPL Zope products to be
redistributed by others, for example by Debian.



regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] License issues

2000-11-14 Thread Juan David Ibáñez Palomar

 
 Has any open source license issue actually come to court yet?
 
 How many people really care about this compared to the number of people
 who just want to get on, develop and use software in an open source
 community fashion and don't want to get involved in religious flame
 wars?
 
 My $0.02
 
 Chris (who doesn't really bother about license issues and hasn't been
 hurt by it yet...)
 
 

this is not about religion and a flame war is the last thing I want

I only wanted to let you know about these facts, and yes there're
projects that have been hurt by "license issues", for example KDE.


regards,
jdavid (who has bet for Zope and is worried about its future)

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] License issues

2000-11-14 Thread Juan David Ibáñez Palomar

 
 
 
 Regaurding licensing, twhile I wouldn't want to snuff out freedom of speech,
 I would say that we have already had the "Licensing Wars" about 18 months
 ago, and things are settled and non negotiable at this point.  Arguing only
 creates tension in the community, which does more damage than good.  If
 people choose not to use Zope because it doesn't have a GPL-style license,
 that is their freedom and we are sorry to see them leave the community, but
 it is impossible to please all of the people all of the time, and the ZPL
 pleases most of the people most of the time---including our investors.
 
 No speaking for Digital Creations! ;-)
 
 Chris
 
 

I didn't know it had already been discussed, I wasn't here 18 months ago,
so that's all, thanks for your patience.


regards,
jdavid

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )