appy.gen: added method wrapper.search1 that returns a single result (which is the only difference with wrapper.search); bugfix while getting objects from the catalog (bypass security when called from code).
This commit is contained in:
parent
cb53c6b9b2
commit
0b6d2d2165
|
@ -206,7 +206,7 @@ class ToolMixin(BaseMixin):
|
||||||
if not res: return
|
if not res: return
|
||||||
res = res[0]
|
res = res[0]
|
||||||
if brain: return res
|
if brain: return res
|
||||||
res = res.getObject()
|
res = res._unrestrictedGetObject()
|
||||||
if not appy: return res
|
if not appy: return res
|
||||||
return res.appy()
|
return res.appy()
|
||||||
|
|
||||||
|
|
|
@ -846,9 +846,9 @@ class BaseMixin:
|
||||||
self.appy().sort(fieldName, sortKey=sortKey, reverse=reverse)
|
self.appy().sort(fieldName, sortKey=sortKey, reverse=reverse)
|
||||||
|
|
||||||
def notifyWorkflowCreated(self):
|
def notifyWorkflowCreated(self):
|
||||||
'''This method is called by Zope/CMF every time an object is created,
|
'''This method is called every time an object is created, be it temp or
|
||||||
be it temp or not. The objective here is to initialise workflow-
|
not. The objective here is to initialise workflow-related data on
|
||||||
related data on the object.'''
|
the object.'''
|
||||||
wf = self.getWorkflow()
|
wf = self.getWorkflow()
|
||||||
# Get the initial workflow state
|
# Get the initial workflow state
|
||||||
initialState = self.State(name=False)
|
initialState = self.State(name=False)
|
||||||
|
|
|
@ -12,13 +12,14 @@ acronym {cursor: help;}
|
||||||
input[type=image] { border: 0; background: none; }
|
input[type=image] { border: 0; background: none; }
|
||||||
input[type=checkbox] { border: 0; background: none; cursor: pointer;}
|
input[type=checkbox] { border: 0; background: none; cursor: pointer;}
|
||||||
input[type=radio] { border: 0; background: none; cursor: pointer;}
|
input[type=radio] { border: 0; background: none; cursor: pointer;}
|
||||||
input[type=file] { border: 0px solid #cccccc; background-color: #f8f8f8;
|
input[type=file] { border: 0px solid #cccccc;
|
||||||
cursor: pointer;}
|
background-color: #f8f8f8; cursor: pointer;}
|
||||||
input[type=button] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
input[type=button] { border: 1px solid #cccccc;
|
||||||
cursor: pointer;}
|
background-color: #f8f8f8; cursor: pointer;}
|
||||||
input[type=submit] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
input[type=submit] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||||
cursor: pointer; }
|
cursor: pointer; }
|
||||||
input[type=password] { border: 1px solid #cccccc; background-color: #f8f8f8;}
|
input[type=password] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||||
|
font-family: Lucida,Helvetica,Arial,sans-serif;}
|
||||||
input[type=text] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
input[type=text] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||||
font-family: Lucida,Helvetica,Arial,sans-serif;
|
font-family: Lucida,Helvetica,Arial,sans-serif;
|
||||||
margin-bottom: 1px}
|
margin-bottom: 1px}
|
||||||
|
|
|
@ -99,9 +99,9 @@
|
||||||
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
|
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
|
||||||
|
|
||||||
<span>Login</span>
|
<span>Login</span>
|
||||||
<input type="text" size="15" name="__ac_name" id="__ac_name" value=""/>
|
<input type="text" size="25" name="__ac_name" id="__ac_name" value=""/>
|
||||||
<span>Password</span>
|
<span>Password</span>
|
||||||
<input type="password" size="15" name="__ac_password" id="__ac_password"/>
|
<input type="password" size="25" name="__ac_password" id="__ac_password"/>
|
||||||
<input type="submit" name="submit" onclick="setLoginVars()"
|
<input type="submit" name="submit" onclick="setLoginVars()"
|
||||||
tal:define="label python: _('Login');" tal:attributes="value label; alt label;"/>
|
tal:define="label python: _('Login');" tal:attributes="value label; alt label;"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -244,6 +244,11 @@ class AbstractWrapper(object):
|
||||||
maxResults=maxResults, noSecurity=noSecurity)
|
maxResults=maxResults, noSecurity=noSecurity)
|
||||||
return [o.appy() for o in res['objects']]
|
return [o.appy() for o in res['objects']]
|
||||||
|
|
||||||
|
def search1(self, *args, **kwargs):
|
||||||
|
'''Identical to m_search above, but returns a single result (if any).'''
|
||||||
|
res = self.search(*args, **kwargs)
|
||||||
|
if res: return res[0]
|
||||||
|
|
||||||
def count(self, klass, noSecurity=False, **fields):
|
def count(self, klass, noSecurity=False, **fields):
|
||||||
'''Identical to m_search above, but returns the number of objects that
|
'''Identical to m_search above, but returns the number of objects that
|
||||||
match the search instead of returning the objects themselves. Use
|
match the search instead of returning the objects themselves. Use
|
||||||
|
|
Loading…
Reference in a new issue