本文整理汇总了Python中tiddlyweb.model.tiddler.Tiddler.fields['_canonical_uri']方法的典型用法代码示例。如果您正苦于以下问题:Python Tiddler.fields['_canonical_uri']方法的具体用法?Python Tiddler.fields['_canonical_uri']怎么用?Python Tiddler.fields['_canonical_uri']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlyweb.model.tiddler.Tiddler
的用法示例。
在下文中一共展示了Tiddler.fields['_canonical_uri']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tiddler_url
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields['_canonical_uri'] [as 别名]
def test_tiddler_url():
tiddler = Tiddler('foobar')
tiddler.bag = 'zoom'
url = tiddler_url(environ, tiddler)
assert url == 'http://our_test_domain:8001/bags/zoom/tiddlers/foobar'
tiddler.recipe = 'car'
url = tiddler_url(environ, tiddler, container='recipes')
assert url == 'http://our_test_domain:8001/recipes/car/tiddlers/foobar'
url = tiddler_url(environ, tiddler, container='recipes', full=False)
assert url == '/recipes/car/tiddlers/foobar'
config['server_prefix'] = '/sleep'
url = tiddler_url(environ, tiddler, container='recipes', full=False)
assert url == '/sleep/recipes/car/tiddlers/foobar'
url = tiddler_url(environ, tiddler)
assert url == 'http://our_test_domain:8001/sleep/bags/zoom/tiddlers/foobar'
tiddler.fields['_canonical_uri'] = 'http://example.com'
url = tiddler_url(environ, tiddler)
# we decided url is always local
#assert url == 'http://example.com'
assert url == 'http://our_test_domain:8001/sleep/bags/zoom/tiddlers/foobar'
示例2: _binary_tiddler
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields['_canonical_uri'] [as 别名]
def _binary_tiddler(environ, bag_name, input_file, target_name):
store = environ['tiddlyweb.store']
username = environ['tiddlyweb.usersign']['name']
binary_storage = BinaryDisk(environ, input_file)
url = binary_storage.store()
tiddler = Tiddler(target_name, bag_name)
tiddler.fields['_canonical_uri'] = url
tiddler.modifier = username
tiddler.type = input_file.type
store.put(tiddler)
return tiddler
示例3: getattr
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields['_canonical_uri'] [as 别名]
try:
links = getattr(links_manager, 'read_%s' % linktype)(tiddler)
except AttributeError, exc:
raise HTTP400('invalid links type: %s' % exc)
if filters:
tiddlers = Tiddlers(title=title)
else:
tiddlers = Tiddlers(title=title, store=store)
for link in links:
if is_link(link):
tiddler = Tiddler(link, 'temp')
tiddler.text = link
tiddler.fields['_canonical_uri'] = link
tiddler.store = store
else:
container, title = link.split(':', 1)
if title: # skip space links for now
try:
recipe = Recipe(container)
recipe = store.get(recipe)
bag = determine_bag_from_recipe(recipe, tiddler, environ)
bag_name = bag.name
except StoreError:
bag_name = container
tiddler = Tiddler(title, bag_name)
try:
tiddler = store.get(tiddler)
except StoreError: