Re: [Zope] Re: urlparse equivalent

2007-12-18 Thread José Henrique
 David Bear skrev:
  On Fri, Dec 14, 2007 at 09:16:54PM +, [EMAIL PROTECTED] wrote:

  I'm a little suprised that there isn't anything like urlparse
  functionaly in zope. I would think parsing urls would be a fairly
  common chore. Which leads me to think that I may be thinking
  completely wrong about what I want to accomplish.


I wrote a script python to substitute urlparse.  You can find it in
http://paste.plone.org/18656.

To use it (assuming that you name it URL) follow this example:

url = context.URL()
scheme, location, path, parameters, query, fragment = u.urlparse(some_url)

Hope it helps.

Zénrique.
___
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] Increment In PT?

2007-07-30 Thread José Henrique
Try this way:

tal:loop repeat=item bitems
input type=hidden tal:attributes=value item/name; name
string:item_name_${repeat/item/number}
input type=hidden tal:attributes=value item/id; name
string:item_number_${repeat/item/number}
/tal:loop

Zenrique.

2007/7/30, Peter Bengtsson [EMAIL PROTECTED]:

 You should now have all the parts.
 Instead of iterating over python:range(1000) do it on bitem_ids instead.

 You don't have to use a br / tag. You can use
 input tal:attributes=value iter/number /
 if you want.
 You increment it by calling tal:iter/next whichever way you do it.

 [EMAIL PROTECTED] wrote:
  I would think this should be pretty easy in the PT itself, given what
  you've shared so far. But I'm still not quite there. Here's what I've
 got:
 
span tal:repeat=bitem_id bitem_ids tal:omit-tag=
 div tal:define=iter
  python:modules['ZTUtils'].Iterator(range(1000))
  br tal:define=x iter/next tal:replace=iter/number /
 
  Now, I don't really want that br / tag there, because it's printing a
  number to screen that I don't want there. However, it only prints the
  number 1 twice, once for each product, when it should print 1 then 2,
  I would think. (I presume I should just take the tal:replace out and
  leave the definition, but it's still not incrementing!) Later in the
  script I have this:
 
  input type=hidden tal:attributes=value item/name;
  name python:'item_name_' + `x`
  input type=hidden tal:attributes=value item/id; name
  python:'item_number_' + `x`
 
  and other similar lines. What I'm trying to effectuate is that the x
  gets replaced with an incremented number. Can you help just a little
 more?
  TIA,
  Tony
 
  -Original Message-
  From: Peter Bengtsson [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Cc: zope@zope.org
  Sent: Mon, 30 Jul 2007 1:32 pm
  Subject: Re: [Zope] Increment In PT?
 
  You can use the ZTUtils Iterator()
 
  div tal:define=iter python:modules['ZTUtils'].Iterator(range(1000))
br tal:define=dummy iter/next tal:replace=iter/number /
br tal:define=dummy iter/next tal:replace=iter/number /
br tal:define=dummy iter/next tal:replace=iter/number /
  /div
 
  Which might give you some freedom such as iter/Roman or iter/odd
  The above is practically the same as:
 
br tal:repeat=i python:range(3) tal:replace=i /
 
  Generally, if you can, use a Python Script or something. The Iterator
  is/was used in Plone templates to increment the tab index.
 
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
Hi;
I´m trying to increment a variable in a page template. Here´s the 
  general idea in my code:
 div metal:define-macro=main tal:define=x python:0
 tal:block tal:define=x python:x + 1
td
input type=hidden tal:attributes=value item/name; name 
  python:'item_name_' + `x`
  Now, all of that works...once. That is, it increments from 0 to
  1, but  not from 1 to 2! Each time I pass through the td element, I
  need it to  increment. I tried putting the tal definition in the td,
  but then it  didn´t even increment once! What do?
TIA,
Tony
   
 
AOL now offers free email to everyone. Find out more about what's
  free  from AOL at *AOL.com*
  http://www.aol.com?ncid=AOLAOF0002000437
  http://www.aol.com/?ncid=AOLAOF0002000437.
 
  
 ___
Zope maillist - Zope@zope.org mailto: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 )
 
  -- Peter Bengtsson,
  work www.fry-it.com http://www.fry-it.com/
  home www.peterbe.com http://www.peterbe.com/
  hobby www.issuetrackerproduct.com http://www.issuetrackerproduct.com/
  
  AOL now offers free email to everyone. Find out more about what's free
  from AOL at *AOL.com* http://www.aol.com?ncid=AOLAOF0002000437.

 --
 Peter Bengtsson,
 work www.fry-it.com
 home www.peterbe.com
 hobby www.issuetrackerproduct.com
 ___
 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 )


Re: [Zope] Increment In PT?

2007-07-30 Thread José Henrique
I understood that 'bitems' was a sequence of dictionaries. Ex: ({'name':
'xyz', 'id': 1'},{'name': 'pex', 'id': 2},{'name': 'wei', 'id': 3}...).
If it's something different, you have to change the code to handle your
object properly.

Zenrique.

2007/7/30, [EMAIL PROTECTED] [EMAIL PROTECTED]:

 It's complaining that:
 *Error Type: TypeError*
 *Error Value: string indices must be integers*
  I tried back ticks and that still gave the same error.
 TIA,
 Tony

 tal:loop repeat=item bitems
 input type=hidden tal:attributes=value item/name; name
 string:item_name_${repeat/item/number}
 input type=hidden tal:attributes=value item/id; name
 string:item_number_${repeat/item/number}
 /tal:loop




___
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] (no subject)

2006-07-20 Thread José Henrique
I couldn't reproduce this behavior. When I try to make such assignement (myObject.title='The new title'), Zope returns this messageattribute-less object (assign or del)
I'm using Zope 2.7.6-final, python 2.3.4.
Jose Henrique2006/7/18, Martijn Pieters [EMAIL PROTECTED]:
On 18 Jul 2006 19:12:54 -, [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Why, given an object called myObject with a title property, can I not change the title by saying simply:
 myObject.title='The new title'You can. Property sheets are aimed at ease of changing through theweb; it is a simple schema for simple properties.--Martijn Pieters___
Zope maillist-Zope@zope.orghttp://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 )


Re: [Zope] ZMI

2005-11-28 Thread José Henrique
Look at the SECURITY.txt file in your ZOPE/doc folder. There you can find instructions to solve your problem.

José Henrique.2005/11/28, Mark Smith [EMAIL PROTECTED]:
I have had to reinstall Plone and Zope on my computer.I now find that whenI try to log into ZMI and http://localhost:8080/manage comes up, it tells methat I am not authorised to view this resource.I am using the correct user
name and password.I would be gratefu if anyone could suggest how toresolve this problem.Yours sincerelyMark Smith___Zope maillist-
Zope@zope.orghttp://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 )


Re: [Zope] now learning zpt

2005-10-18 Thread José Henrique
You can find this information in the Zope Book: http://www.plope.com/Books/2_7Edition/ScriptingZope.stx#1-6

Zenrique.2005/10/18, Garry Saddington [EMAIL PROTECTED]:
Having had a bit of a lambasting over my use of dtml, I have started tolearn zpt. However, I am curious about the following:How do you do the equivalent of name=comp.name:records to submitmultiple values to zsql or to a python script, especially when the
initial list is generated dynamically.regardsGarry___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 )