<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="Open WebMail 2.10 20030617" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>

<font size="2"><b><span style="font-weight: bold;"></span></b>John,
<br />
<br />I have never done it with the addform approach but it is very easily done with formlib.
<br />
<br />class MyContentAddForm(form.AddForm):
<br />  form_fields = form.Fields(IMyContent)
<br />
<br />  def __init__(self, context, request):
<br />    self.context = context
<br />    self.request = request
<br />
<br />  def create(self, data):
<br />    mycontent = MyContent()
<br />    mycontent.title = data['title']
<br />    mycontent.user = self.request.principal.id
<br />    return mycontent
<br />
<br />Register it as a page in your config file
<br />
<br />&lt;page
<br />  for=&quot;.content.MyContent&quot;
<br />  name=&quot;AddContent.html&quot;
<br />  class=&quot;.forms.MyContentAddForm&quot;
<br />  permission=&quot;zope.ManageContent&quot; /&gt;
<br />
<br />
<br />Cheers,
<br />
<br />Mats
<br />
<br />  
<br /><b>
<br />On Tue, 20 Jun 2006 22:42:18 +0100 (BST), John Smith wrote</b>
<br />&gt; Hi,
<br />&gt; 
<br />&gt;  I am trying to add some request related data into a content object (eg authenticated user etc).
<br />&gt; 
<br />&gt;  The content is being added using a normal addform/content_factory zcml approach.
<br />&gt; 
<br />&gt;  The class __init__ method does not receive any arguments, and the context/request pair are only available inside of views.
<br />&gt; 
<br />&gt;  So I am stumped.
<br />&gt; 
<br />&gt;  How do I get at the request object? A utility? An adaptor?
<br />&gt; 
<br />&gt;  Thanks,
<br />&gt; 
<br />&gt;  John
<br />&gt; 
<br />&gt;  
                
<hr size="1" /> 
Try the <a href="http://us.rd.yahoo.com/mail/uk/taglines/default/nowyoucan/wall_st_2/*http://us.rd.yahoo.com/evt=40565/*http://uk.docs.yahoo.com/nowyoucan.html">all-new Yahoo! Mail</a> . &quot;The New Version is radically easier to use&quot; – The Wall Street Journal

<br />
<br />
<br />
</font>
</BODY>
</HTML>