本文整理汇总了Python中zc.resourcelibrary.need函数的典型用法代码示例。如果您正苦于以下问题:Python need函数的具体用法?Python need怎么用?Python need使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了need函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __call__
def __call__(self):
need("yui-paginator")
script_html, script_js = self.get_search_widgets()
return '%s<div id="%s">\n%s%s</div>' % (script_html,
self.prefix,
self.script % self.getDataTableConfig(),
script_js)
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:7,代码来源:table.py
示例2: update
def update(self):
source = createObject("tackle.markdown", self.context.description)
renderer = getMultiAdapter((source, self.request))
self.description = renderer.render()
need("tacklets.project")
need("tacklets.todo")
开发者ID:ilshad,项目名称:tacklets,代码行数:7,代码来源:display.py
示例3: __call__
def __call__(self):
# require tiny-mce
need("tiny-mce")
need("tiny-mce-config")
# render default input widget for text
input_widget = super(RichTextEditor, self).__call__()
return input_widget
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:7,代码来源:widgets.py
示例4: highlightscript
def highlightscript(self):
need("highlight")
words = filter(lambda x: x,
self.request.form.get("%s.full_text" % self.prefix, "").split(" "))
def highliightword(x):
return """$("#search-results").highlight("%s", true);""" % x
words = "\n".join(map(highliightword, words))
return """
<script type="text/javascript">
var ch = document.getElementById("%s");
function highlightwords(){
$("#search-results").removeHighlight();
if (ch.checked) {
%s
}
}
function radioHighlightChangeonclick(){
ch.onclick=function(){
highlightwords();
}
highlightwords();
}
window.onload = radioHighlightChangeonclick;
</script>
""" % ("%s.highlight" % self.prefix, words)
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:26,代码来源:search.py
示例5: __call__
def __call__(self):
need("yui-paginator")
return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
self.prefix,
self._getCSSClass("table"),
self.renderContents(),
self.script(**self.getDataTableConfig()))
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:7,代码来源:table.py
示例6: __init__
def __init__(self, *args):
super(SelectDateWidget, self).__init__(*args)
need("yui-core")
need("yui-calendar")
need("yui-container")
need("yui-element")
need("yui-button")
self.minDate = datetime.date.today() - datetime.timedelta(self.minYearDelta * 365)
self.maxDate = datetime.date.today() + datetime.timedelta(self.maxYearDelta * 365)
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:9,代码来源:widgets.py
示例7: render
def render(self, template=None):
need("bungeni-calendar-bundle")
if template is None:
template = self.template
if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
(IBusinessSectionLayer.providedBy(self.request)):
self.edit = False
else:
self.edit = True
return template()
开发者ID:gelie,项目名称:bungeni_src,代码行数:10,代码来源:browser.py
示例8: render
def render(self, template=None):
need("dhtmlxscheduler")
need("dhtmlxscheduler-recurring")
if template is None:
template = self.template
if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
(IBusinessSectionLayer.providedBy(self.request)):
self.edit = False
else:
self.edit = True
return template()
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:11,代码来源:browser.py
示例9: update
def update(self):
need('bbru.answers')
formatter = self.request.locale.dates.getFormatter('date')
auth = getUtility(IAuthentication)
dc = IZopeDublinCore(self.context)
principal = auth.getPrincipal(dc.creators[0])
self.user = principal.title
self.created = formatter.format(dc.created)
self.title = dc.title
开发者ID:domashevskiy,项目名称:bbru,代码行数:12,代码来源:display.py
示例10: update
def update(self):
need("ice.control.tree.css")
need("ice.control.tree.js")
if queryUtility(IDispatcher) is not None:
need("ice.control.repl.css")
need("ice.control.repl.js")
self.content = self.context.get_content()
开发者ID:fudong1127,项目名称:ice.control,代码行数:9,代码来源:tree.py
示例11: render
def render(self, date, template=None):
#need('yui-editor')
need('yui-connection')
need('yui-rte')
need('yui-resize')
need('yui-button')
if template is None:
template = self.template
container = self.context.__parent__
#schedule_url = self.request.getURL()
container_url = url.absoluteURL(container, self.request)
# determine position in container
key = stringKey(self.context)
keys = list(container.keys())
pos = keys.index(key)
links = {}
if pos > 0:
links['previous'] = "%s/%s/%s" % (
container_url, keys[pos-1], self.__name__)
if pos < len(keys) - 1:
links['next'] = "%s/%s/%s" % (
container_url, keys[pos+1], self.__name__)
#start_date = utils.datetimedict.fromdatetime(self.context.start_date)
#end_date = utils.datetimedict.fromdatetime(self.context.end_date)
site_url = url.absoluteURL(getSite(), self.request)
reorder = "reorder" if self.context.status in \
["draft_agenda", "draft_minutes"] \
else "dont-reorder"
return template(
display="sitting",
#title=_(u"$A $e, $B $Y", mapping=start_date),
title = "%s: %s - %s" % (self.context.group.short_name,
self.context.start_date.strftime('%Y-%m-%d %H:%M'),
self.context.end_date.strftime('%H:%M')),
description=_(u"Sitting Info"),
# title = u"",
# description = u"",
#
links=links,
actions=get_sitting_actions(self.context, self.request),
items=get_sitting_items(
self.context, self.request, include_actions=True),
#categories=vocabulary.ItemScheduleCategories(self.context),
new_category_url="%s/admin/content/categories/add?next_url=..." % site_url,
status=self.context.status,
reorder=reorder,
)
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:54,代码来源:browser.py
示例12: render
def render(self):
if haveResourceLibrary:
resourcelibrary.need('tiny_mce')
mceOptions = []
for k in dir(self):
if k.startswith(OPT_PREFIX):
v = getattr(self,k,None)
v = v==True and 'true' or v==False and 'false' or v
if v in ['true','false']:
mceOptions.append('%s : %s' % (k[OPT_PREFIX_LEN:],v))
elif v is not None:
mceOptions.append('%s : "%s"' % (k[OPT_PREFIX_LEN:],v))
mceOptions = ', '.join(mceOptions)
if mceOptions:
mceOptions += ', '
if self.request.locale.id.language in MCE_LANGS:
mceOptions += ('language : "ru",')
widget_html = super(TinyWidget,self).render()
return template % {"widget_html": widget_html,
"name": self.name,
"options": mceOptions}
开发者ID:HengeSense,项目名称:Qreature,代码行数:21,代码来源:widget.py
示例13: update
def update(self):
need("yui-dragdrop")
need("yui-container")
sitting = self._parent._parent.context
scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
# add location to items
gsm = component.getSiteManager()
adapter = gsm.adapters.lookup(
(interface.implementedBy(self.model), interface.providedBy(self)),
ILocation
)
date_formatter = self.get_date_formatter("date", "medium")
items = [ adapter(item, None) for item in self._query_items() ]
# for each item, format dictionary for use in template
self.items = [{
"title": properties.title,
"name": item.__class__.__name__,
"description": properties.description,
#"date": _(u"$F", mapping={"F":
# datetimedict.fromdatetime(item.changes[-1].date)}),
#"date":item.changes[-1].date,
# not every item has a auditlog (headings)
# use last status change instead.
"date": date_formatter.format(self._item_date(item)),
"state": IWorkflow(item).get_state(item.status).title,
"id": item.parliamentary_item_id,
"class": (
(item.parliamentary_item_id in scheduled_item_ids and
"dd-disable") or
""),
"url": self._item_url(item),
"type": item.type
} for item, properties in [
(item, (IDCDescriptiveProperties.providedBy(item) and item or
IDCDescriptiveProperties(item)))
for item in items ]
]
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:40,代码来源:schedule.py
示例14: update
def update(self):
need('yui-dragdrop')
need('yui-container')
session = Session()
group_id = self.get_group_id()
items = tuple(session.query(self.model).filter(
sql.and_(
self.model.status.in_(self.states),
self.model.group_id == group_id)
))
sitting = self._parent._parent.context
scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
# add location to items
gsm = component.getSiteManager()
adapter = gsm.adapters.lookup(
(interface.implementedBy(self.model),
interface.providedBy(self)), ILocation)
items = [adapter(item, None) for item in items]
# for each item, format dictionary for use in template
self.items = [{
'title': properties.title,
'name': item.__class__.__name__,
'description': properties.description,
#'date': _(u"$F", mapping={'F':
# datetimedict.fromdatetime(item.changes[-1].date)}),
'date': item.changes[-1].date_active,
'state': _(IWorkflow(item).workflow.states[item.status].title),
'id': item.parliamentary_item_id,
'class': (item.parliamentary_item_id in
scheduled_item_ids) and "dd-disable" or "",
'url': url.set_url_context(url.absoluteURL(item, self.request))
} for (item, properties) in [
(item, (IDCDescriptiveProperties.providedBy(item) and item or
IDCDescriptiveProperties(item)))
for item in items ]
]
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:40,代码来源:schedule.py
示例15: __call__
def __call__(self):
# require yahoo rich text editor and dependencies
need("yui-rte")
need("yui-resize")
need("yui-button")
# render default input widget for text
input_widget = super(RichTextEditor, self).__call__()
# use "_" instead of "." for js identifiers
jsid = self.name.replace(".", "_")
# attach behavior to default input widget, disable titlebar
input_widget_js = u"""
<script type="text/javascript">
options={ height:'300px',
width:'100%%',
dompath:true,
animate:true,
focusAtStart:false,
markup:'xhtml'};
var %(jsid)s_editor = new YAHOO.widget.Editor('%(js_name)s', options);
YAHOO.util.Event.on(
%(jsid)s_editor.get('element').form,
'submit',
function(ev) {
%(jsid)s_editor.saveHTML();
}
);
%(jsid)s_editor._defaultToolbar.titlebar = false;
%(jsid)s_editor.on('editorContentLoaded', function() {
resize = new YAHOO.util.Resize(%(jsid)s_editor.get('element_cont').get('element'), {
handles: ['br'],
autoRatio: true,
status: true,
proxy: true,
setSize: false //This is where the magic happens
});
resize.on('startResize', function() {
this.hide();
this.set('disabled', true);
}, %(jsid)s_editor, true);
resize.on('resize', function(args) {
var h = args.height;
var th = (this.toolbar.get('element').clientHeight + 2); //It has a 1px border..
var dh = (this.dompath.clientHeight + 1); //It has a 1px top border..
var newH = (h - th - dh);
this.set('width', args.width + 'px');
this.set('height', newH + 'px');
this.set('disabled', false);
this.show();
}, %(jsid)s_editor, true);
});
%(jsid)s_editor.render();
</script>
"""
return input_widget + \
input_widget_js % {"jsid": jsid, "js_name": self.name}
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:59,代码来源:widgets.py
示例16: render
def render(self, template=None):
need("dhtmlxscheduler")
need("dhtmlxscheduler-recurring")
if template is None:
template = self.template
if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
(IBusinessSectionLayer.providedBy(self.request)):
self.edit = False
else:
self.edit = True
session = Session()
venues = session.query(domain.Venue).all()
languages = get_all_languages()
# !+SESSION_CLOSE(taras.sterch, july-2011) there is no need to close the
# session. Transaction manager will take care of this. Hope it does not
# brake anything.
#session.close()
self.display_language = get_default_language()
if self.request.get("I18N_LANGUAGE"):
self.display_language = self.request.get("I18N_LANGUAGE")
#html is hardcoded in here because doing it in the template
#would have been a colossal pain
#TODO: FIX THIS
s = '<div class="dhx_cal_ltext" style="height:90px;">'
s += '<table>'
s += '<tr><td>Venue</td><td><select id="select_sitting_venue">'
for venue in venues:
s += '<option value="'+str(venue.venue_id)+'">'+venue.short_name+'</option>'
s += '</select></td></tr>'
s += '<tr><td>Language</td><td><select id="select_sitting_lang">'
for lang in languages:
if lang == 'en':
s += '<option value="'+lang+'" selected>'+lang+'</option>'
else:
s += '<option value="'+lang+'">'+lang+'</option>'
s += '</select></td></tr></table></div>'
self.sitting_details_form = s
return template()
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:38,代码来源:browser.py
示例17: __call__
def __call__(self):
need("yui-json")
need("yui-datasource")
need("yui-autocomplete")
input_widget = super(TimeWidget, self).__call__()
auto_container = u'<div id="%s" class="yui-skin-sam"></div>' % (
self.options_container)
return "<div class='ac_time_container'>%s%s%s</div>" %(
input_widget, auto_container, self.js)
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:9,代码来源:widgets.py
示例18: __call__
def __call__(self):
need('yui-datatable')
need('yui-paginator')
need('yui-dragdrop')
return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
self.prefix,
self._getCSSClass('table'),
self.renderContents(),
self.script(**self.getDataTableConfig()))
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:10,代码来源:table.py
示例19: render
def render(self):
need("hansard-css")
return self.template()
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:3,代码来源:browser.py
示例20: __call__
def __call__(self):
need("yui-datatable")
self.update()
return self.template()
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:4,代码来源:container.py
注:本文中的zc.resourcelibrary.need函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论