[Zope-dev] PythonScript for iso_week

2001-03-14 Thread Steve Alexander

Hi folks,

At various times in the past, people on this list have asked about 
getting week numbers from DateTime instances.

I recently had this requirement, so I wrote a PythonScript to produce an 
iso_week tuple (year, week_number, dow_monday_is_one__sunday_is_seven) 
from a DateTime instance.

I've submitted the same to the collector as a feature-enhancement patch 
to DateTime.py.

I've tested this by empirically comparing it with the output of 
mxDateTime's iso_week attribute for all days from 1920-01-01 to some 
date in the twenty-third century.

Note also that this iso_week method does not create additional DateTime 
instances.

See also http://www.cl.cam.ac.uk/~mgk25/iso-time.html


PythonScript iso_week

Parameters: date

doy=date.dayOfYear()
dow=(date.dow()-1)%7
y=date.year()
thurs_this_week=doy+(3-dow)
is_leap=y%4==0 and (y%100!=0 or y%400==0)

if thurs_this_week(is_leap and 366 or 365):
   week=1
   if dow8:
 y=y+1
else:
   mon_this_week=doy-dow
   day_year_begins=(dow-doy+1)%7
   day_of_4_jan=(day_year_begins+3)%7
   monday_of_first_week=4-day_of_4_jan
   week=(mon_this_week-monday_of_first_week)/7+1

   if week==0:
 y=y-1
 is_last_leap=y%4==0 and (y%100!=0 or y%400==0)
 if day_year_begins==4 or (day_year_begins==5 and is_last_leap):
   week=53
 else:
   week=52

return y,week,dow+1



--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


___
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] Zope on OpenBSD 2.8 makes me cry

2001-03-14 Thread Ivo van der Wijk

According to a posting on an openBSD mailinglist, the solution is to
use 2.8-current.

See http://www.geocrawler.com/lists/4/OpenBSD/256/25/5337829/

I don't use openBSD myself so I can't help you with this, but a colleague
here uses it and pointed me to this posting.

Cheers,

Ivo

-- 
Drs. I.R. van der Wijk  -=-
Brouwersgracht 132  Amaze Internet Services V.O.F.
1013 HA Amsterdam   -=-
Tel: +31-20-4688336   Linux/Unix based corporate   
Fax: +31-20-4688337 and   
Web: http://www.amaze.nl/Internet Solutions   
Email:   [EMAIL PROTECTED]   -=- 

___
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] Re: [Zope] Is ZFormulator alive?

2001-03-14 Thread R. David Murray

On Tue, 13 Mar 2001, Arno Gross wrote:
 Any hints?

A *workaround* (that worked as of 2.2, not sure about 2.3 (of zope)) is
to log in as the superuser to create the fields.

--RDM


___
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] zwiki chinese

2001-03-14 Thread Sin Hang Kin

in my current effort to try make zwiki work in chinese, i have done the
following:

i remove the intl_char_entities and add to _create_page:

#make a new (blank) page object
page = re.sub("%","",quote(page))

which make the created pageid valid zopeid (does it work all_the_time?)

however, the page is created, but zwiki fail to recognize the new page and
fail to link to it.

can anybody help point to me where should i make further changes?

moreover, is it possible to create a corresponding wikiname - id link so
the wikiname does not necessary a valid zope id?

when we make editing the wiki page, is it a worth to have a list of all
valid wiki name handy so we can make reference to them or avoid making an
unexpected link?


Rgs,

Kent Sin
-
kentsin.weblogs.com
kentsin.imeme.net


___
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] Permission problems

2001-03-14 Thread Dieter Maurer

morten writes:
  I've been struggling with some permission problems, and I'd appreciate
  some help...
Maybe, you take a look at

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html

Perhaps, its security section make some aspects clearer.


Dieter

___
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 )