本文整理汇总了Python中config.Configuration.tiny_collection_languages方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.tiny_collection_languages方法的具体用法?Python Configuration.tiny_collection_languages怎么用?Python Configuration.tiny_collection_languages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.tiny_collection_languages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_default_lanes
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import tiny_collection_languages [as 别名]
def create_default_lanes(_db, library):
"""Reset the lanes for the given library to the default.
The database will have the following top-level lanes for
each large-collection:
'Adult Fiction', 'Adult Nonfiction', 'Young Adult Fiction',
'Young Adult Nonfiction', and 'Children'.
Each lane contains additional sublanes.
If an NYT integration is configured, there will also be a
'Best Sellers' top-level lane.
If there are any small- or tiny-collection languages, the database
will also have a top-level lane called 'World Languages'. The
'World Languages' lane will have a sublane for every small- and
tiny-collection languages. The small-collection languages will
have "Adult Fiction", "Adult Nonfiction", and "Children/YA"
sublanes; the tiny-collection languages will not have any sublanes.
If run on a Library that already has Lane configuration, this can
be an extremely destructive method. All new Lanes will be visible
and all Lanes based on CustomLists (but not the CustomLists
themselves) will be destroyed.
"""
# Delete existing lanes.
for lane in _db.query(Lane).filter(Lane.library_id==library.id):
_db.delete(lane)
top_level_lanes = []
# Hopefully this library is configured with explicit guidance as
# to how the languages should be set up.
large = Configuration.large_collection_languages(library) or []
small = Configuration.small_collection_languages(library) or []
tiny = Configuration.tiny_collection_languages(library) or []
# If there are no language configuration settings, we can estimate
# the current collection size to determine the lanes.
if not large and not small and not tiny:
estimates = library.estimated_holdings_by_language()
large, small, tiny = _lane_configuration_from_collection_sizes(estimates)
priority = 0
for language in large:
priority = create_lanes_for_large_collection(_db, library, language, priority=priority)
create_world_languages_lane(_db, library, small, tiny, priority)