Re: [Zope3-Users] Where do people put Zope 3 components that they wish to share?

2007-03-18 Thread TAHARA Yusei
Hi,

You can find packages at zope.org repository or cheeseshop in python.org.

subversion repository
http://svn.zope.org/

cheeseshop
http://cheeseshop.python.org/pypi?:action=browse&show=all&c=515

--
Yusei Tahara
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie database adapter questions

2007-02-01 Thread TAHARA Yusei
Hi.

You can use z3c.zalchemy or sqlos(sqlobject wrapper) for OR mapping.

zalchemy
http://svn.zope.org/z3c.zalchemy/trunk/src/z3c/zalchemy/

sqlos
http://codespeak.net/z3/sqlos/

Thanks.

-- 
Yusei TAHARA
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ComponentLookupError

2006-12-13 Thread TAHARA Yusei
Hi,

> ComponentLookupError: (( 0x4203972c>,  URL=http://192.168.81.89:8090/CRM/Vanderbilt/@@+/action.html>),  
> , u'')

This error means that Zope cannot find input widget for
the interface "decimalwidget.widget.Decimal" provides.

I don't know about "decimalwidget.widget.Decimal", but I think you
need to define input widget for interface of decimal field by ZCML.

-- 
TAHARA Yusei
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] schema field for an Image?

2006-12-06 Thread Tahara Yusei
Hi,

> If I wanted to use formlib to build the form, and wanted to build a HTML 
> widget for the image field that had a
> file input for uploading, and if img already had content woudl display a 
> thumbnail; how would I go about this? I'm afraid I'm lost because its 
> schema.Object that the widget would apply to (but I'm not sure).

In such case, I use custom widget.

"""
from zope.app.form.browser.textwidgets import FileWidget
from zope.app.file.image import Image
class MyImageWidget(FileWidget):
  class_ = Image
  def _toFieldValue(self, input):
value = super(_toFieldValue, self)._toFieldValue(input)
return self.class_(value)

from zope.formlib import form
class MyEditForm(form.PageEditForm):
  form_fields = form.FormFields(IMyContent)
  form_fields['image'].custom_widget = MyImageWidget
"""

And there is widget subdirective in addform/editform directives in zcml.

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Registering adapter for ListSequence widget in tests

2006-09-06 Thread TAHARA Yusei
At Wed, 06 Sep 2006 09:29:15 +0200,
Philipp von Weitershausen wrote:
> 
> TAHARA Yusei wrote:
> > I think you should use zope.app.testing.ztapi.provideAdapter instead.
> 
> No! ztapi.provideAdapter is discouraged. zope.component.provideAdapter 
> is the recommended spelling.

Oh, sorry. I did not know that...

--
TAHARA Yusei
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Registering adapter for ListSequence widget in tests

2006-09-05 Thread TAHARA Yusei
Hi.

I think you should use zope.app.testing.ztapi.provideAdapter instead.

See zope/app/form/browser/tests/test_objectwidget.py,
this is a good example.

--
TAHARA Yusei
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie problem

2006-09-02 Thread TAHARA Yusei
Hi.

You should use "svn://" instead of "http://";.

svn co svn://svn.zope.org/repos/main/z3c.zalchemy/trunk

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to make content object return a view?

2006-05-25 Thread TAHARA Yusei
Hi.

>
>I tried zapi.getView(), but this has been deprecated, and I don't quite
>understand the best approach.
>
You need to use zapi.getMultiAdapter.
(this is a alias for zope.component.getMultiAdapter)

Because content view is named multiadapter for content's interface and
IBrowserRequest interface, example below:

  zapi.getMultiAdapter((content, request), IBrowserView, name='index.html')


I recommend to read src/zope/interface/adapter.txt. It is a very good
documentation for adapter and zope component architecture.

Regards,
--
TAHARA Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Oracle Adapter

2006-04-26 Thread TAHARA Yusei
Hi.

> there is an Oracle database adapter available?

Yes, here http://svn.zope.org/cxoracleda/trunk/

--
Yusei Tahara
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] session id

2006-01-02 Thread TAHARA Yusei
Hello.

At Mon, 2 Jan 2006 21:48:11 +1100,
Simon Hang wrote:
> How can I use zope session id(client_id) in .pt template? I'm not
> understanding zope's session id management very well.
> Sometime, I can get session id using code like this
> 
> 
> 
> But strange think is sometimes request object has empty cookie. above code
> will generate errors.
> 
> I know I can get session id using a function like below:
> ...
> def SessionData(self):
> return ISession(self.request).client_id
> ...
> 
> but is it possible to do this ONLY using a .pt file?

How about make a tales namespace for session api?

Regards,

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: browser:page and zope.formlib to replace browser:addform?

2005-12-18 Thread TAHARA Yusei
Hello.

At Sun, 18 Dec 2005 18:40:52 +0530,
baiju m wrote:
> > Also how to use templates along with zope.formlib forms?
> 
> Hmm.. any help pointer?

You can use zope.formlib.namedtemplate for form's template.

By default, zope.formlib.form.default_page_template and pageform.pt is
used in forms.

So you can replace it to your own namedtemplate, simply like this::

  class CompaniesView(form.AddForm):

  form_fields = form.Fields(ICompany)

  template = namedtemplate.NamedTemplate('company')

  def create(self, data):
  company = Company()
  company.name = data['name']
  company.description = data['description']
  return company

  company_page_template = namedtemplate.NamedTemplateImplementation(
  ViewPageTemplateFile('companyform.pt'),
  form.interfaces.IPageForm)

and configuration::

  

template::

  
  
  
  
  
  
  
  
  

Best regards,

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie: can't find ZopeTop

2005-12-08 Thread TAHARA Yusei
Hi.

At Thu, 08 Dec 2005 09:28:43 +,
CGIP CGIP wrote:
> 
> hi list
> have loaded zope3 on windows and have tried the url
> http://localhost:9080/++skin++ZopeTop
> (from ZopetopTenChanges document - 1st task)
> 
> "the connection was refused when attempting to contact
> loacalhost:9080"
> 
> do i need to fiddle with something ? 
> cheers
> rich

Can you show us your zope.conf?

If you want to use port 9080,
you should configure zope.conf as shown below.


  type HTTP
  address 9080


Best Regards,

-- 
TAHARA Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] MessageBoard tutorial deprecation warnings

2005-11-02 Thread TAHARA Yusei
Hello.

At Mon, 31 Oct 2005 00:53:08 -0600,
Brad Allen wrote:
> 
> 
> The messageboard tutorial in the Zope 3 Developer's Handbook
> doesn't seem to work for me. I'm using the copy from 
> 
> svn co svn://svn.zope.org/repos/main/book/trunk
> 
> The SVN url listed in the book didn't work, but I'm not
> sure this is the right one. 
> 
> Anyway, I'm using the "step13" folder, and when I registered
> it with my Zope 3.1 instance on Ubuntu, and run Zope, I get
> the following in my transcript.log:
> 
> ConfigurationError: ('Invalid value for', 'interface', "Couldn't
> import zope.app.workflow.interfaces, No module named workflow.interfaces
> in zope.app.workflow.interfaces.IProcessInstanceContainerAdaptable")
> 
> I wanted to see more detail on that error, so I imported the offending
> module at the Python interactive prompt. Along the way several
> deprecation warnings cropped up (see below). Is there a newer
> version of this tutorial I'm missing out on, or should I spend
> some time trying to clean this up?

I think stateful workflow is no longer supported in zope3.

this is a disscusion about stateful workflow.
http://mail.zope.org/pipermail/zope3-dev/2005-October/015997.html

Best Regards,
--
Tahara Yusei
[EMAIL PROTECTED]

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Any document for use ZopeDatabaseAdapter?

2005-10-29 Thread TAHARA Yusei
Hi.

At Fri, 28 Oct 2005 20:43:37 +1000,
Simon Hang wrote:
> Hi,
>  
> Is there any document or examples for ZopeDatabaseAdapter?
>  
> I need to do some sql query in my content object.

I don't know tutorials or examples, but you can use it simply like a
python dbi module.

First you need to setup DA and register it as a utility in
sitemanager, then you can get DA using by zapi.getUtility.

DA interface is very similar to python dbi module. I think zope3
becomes easier than zope2 to make rdb application.


from zope.app import zapi
from zope.app.rdb.interfaces import IZopeDatabaseAdapter
from zope.app.rdb import sqlquote
from zope.app.sqlscript.dtml import SQLDTML

class TableView:

def cursor(self):
da = zapi.getUtility(IZopeDatabaseAdapter, 'gadfly', self.context)
con = da()
return con.cursor()

def getdata(self):
cursor = self.cursor()
cursor.execute('select name from mytable')
return cursor.fetchall()

def insertdata(self, name):
cursor = self.cursor()
template = SQLDTML('insert into mytable values()')
cursor.execute(template(name=name))
self.request.response.redirect('@@list.html')

Best Regards,

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Where is the apidoc?

2005-10-23 Thread TAHARA Yusei
Hi.

On Sun, 23 Oct 2005 14:34:11 +0200
Florian Lindner <[EMAIL PROTECTED]> wrote:

> Hello,
> sounds stupid, but I can't find the apidoc in a recent SVN version. 
> http://horus:8080/++apidoc++ returns a 404.

I have a lastest version, but I can use the apidoc.

Can you show us the error message?

Best Regards,
--
Tahara yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] catalog indexing adapter interfaces

2005-10-22 Thread TAHARA Yusei
Hi.

At Thu, 20 Oct 2005 11:48:41 +1000,
Alen Stanisic wrote:
> I noticed that if I adapted a persistent content type and created a
> catalog with index on one of the fields provided by the adapter
> interface, the indexing worked for all of my content that was there at
> time of catalog creation.  But any new content objects created after
> catalog creation would not get indexed though.

It doesn't make sense to me.

I use catalog for my application and indexing worked after added
new content. I think catalog does not index object that was added before
catalog creation.

catalog has event subscribers in zope/app/catalog/configure.zcml
and does automatic indexing for adaptable objects.

Best Regards,

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to allow one user to access only his object

2005-10-22 Thread TAHARA Yusei
Hi.

At Fri, 21 Oct 2005 23:01:55 -0700,
Naotoshi Seo wrote:
> 
> I got another trouble. I succeeded to show edit.html, but I could not 
> edit actaully.
> 
> edit.html is an editview page. So, the html has post tag like
> http://.../messageboardobject/edit.html";>
> Therefore, same traverser trys to receive this posted action, and trys 
> to check password again (actually, and id) to find message object.
> Therefore, I have to pass password and id which was posted before at 
> password.html using hidden field or some ways. Or, I have to specify 
> different page for   . I have no idea how editview's 
> post action is working, so I am not sure specifying different page for 
> post action works, though.

I think that would be a different issue, you should separate a plan
from "prohibit visitors from to access edit.html".

ZCML's editform is not flexible, so it is hard to add one more field in
auto-generated form. If you want to do, you may need zope.formlib package.

But I have another idea. We can use session for making stateful application.
then user doesn't need to post his password again.

And this is a little trick make a container to show its content's editform.

"""
from zope.app.session.interfaces import ISession

PACKAGE_NAME = 'your application name'

class MessageEditView:

def __init__(self, context, request):

session = ISession(request)[PACKAGE_NAME]

password = request.get('password')
if password is None:
password = session.get('password')

message = getMessage(context, password) # please implement this:)

session['password'] = password

self.context = message # trick1
self.request = request
self._setUpWidgets()


"""

-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to allow one user to access only his object

2005-10-21 Thread TAHARA Yusei
Hi.

On Fri, 21 Oct 2005 05:06:32 -0700
Naotoshi Seo <[EMAIL PROTECTED]> wrote:
> At this post method, do I redirect to a URL like 
> ./edit.html?field.passwd=KDJFKJA ? It is not cool. Are there any ways?

Why you don't post to "edit.html" from "password.html"?


> Furthermore, returning object in publishTraverse() did not work. I had 
> to create a view like zapi.queryView(subob, name, request). Why? Am I 
> missing something?

zapi.queryView has been deprecated. You should use queryMultiAdapter.
queryMultiAdapter((self.context, request), name=name)


> Furthermore, can I prohibit users to access directly as 
> http://localhost:8080/messageboardobject/messageobject/edit.html? It 
> looks I have to keep open this URL so that Traverser can open this. But, 
> if this is possible, nothing was changed from before.

if MessageBoardTraverser works well, you can protect "edit.html"
from invalid access.

Best Regards,
-- 
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to allow one user to access only his object

2005-10-20 Thread TAHARA Yusei
On Thu, 20 Oct 2005 22:19:58 -0700
Naotoshi Seo <[EMAIL PROTECTED]> wrote:
> This is easy problem in normal web application. Scripts which receive
> POST just print out new html (in this case Classname.post). However, I
> would like to use browser:editview and I have only idea, redirecting, to
> show the editview.

If I need to make the feature, I'll make a Traverser for IMessage.

something like...

class MessageTraverser:

implements(IPublishTraverse)
__used_for__ = IMessage

def publishTraverse(self, request, name):
if name == 'edit.html':
# verify password and return a message or raise NotFoundError.

I referred a zwiki's traverser implementation.

Best Regards,
--
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to pass an added object to redirected page

2005-10-20 Thread TAHARA Yusei
Hello.

On Thu, 20 Oct 2005 20:20:17 -0700
Naotoshi Seo <[EMAIL PROTECTED]> wrote:
> So, this is just redirecting to different page after users add object.
> I have no idea to access to the data of the added object at
> 'nexturl.html'. If possible, I can show what users inputted.

You can use "add" method in view class.

from zope.app.zapi import absoluteURL

class MyAddView:

def add(self, content):
content = self.context.add(content) # you need locatable object.
self.next_url = absoluteURL(content, self.request)

def nextURL(self):
return self.next_url

Best Regards,
--
Tahara Yusei
[EMAIL PROTECTED]
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users