A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

681 lines
28 KiB

  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright (C) 2009-2012 by Ben Kurtovic <ben.kurtovic@verizon.net>
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a copy
  6. # of this software and associated documentation files (the "Software"), to deal
  7. # in the Software without restriction, including without limitation the rights
  8. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. # copies of the Software, and to permit persons to whom the Software is
  10. # furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. # SOFTWARE.
  22. from hashlib import md5
  23. import re
  24. from time import gmtime, strftime
  25. from urllib import quote
  26. from earwigbot.wiki.copyright import CopyrightMixin
  27. from earwigbot.wiki.exceptions import *
  28. __all__ = ["Page"]
  29. class Page(CopyrightMixin):
  30. """
  31. EarwigBot's Wiki Toolset: Page Class
  32. Represents a Page on a given Site. Has methods for getting information
  33. about the page, getting page content, and so on. Category is a subclass of
  34. Page with additional methods.
  35. Public methods:
  36. title -- returns the page's title, or pagename
  37. exists -- returns whether the page exists
  38. pageid -- returns an integer ID representing the page
  39. url -- returns the page's URL
  40. namespace -- returns the page's namespace as an integer
  41. protection -- returns the page's current protection status
  42. creator -- returns the page's creator (first user to edit)
  43. is_talkpage -- returns True if the page is a talkpage, else False
  44. is_redirect -- returns True if the page is a redirect, else False
  45. toggle_talk -- returns a content page's talk page, or vice versa
  46. get -- returns page content
  47. get_redirect_target -- if the page is a redirect, returns its destination
  48. edit -- replaces the page's content or creates a new page
  49. add_section -- adds a new section at the bottom of the page
  50. copyvio_check -- checks the page for copyright violations
  51. """
  52. re_redirect = "^\s*\#\s*redirect\s*\[\[(.*?)\]\]"
  53. def __init__(self, site, title, follow_redirects=False):
  54. """Constructor for new Page instances.
  55. Takes three arguments: a Site object, the Page's title (or pagename),
  56. and whether or not to follow redirects (optional, defaults to False).
  57. As with User, site.get_page() is preferred. Site's method has support
  58. for a default `follow_redirects` value in our config, while __init__
  59. always defaults to False.
  60. __init__ will not do any API queries, but it will use basic namespace
  61. logic to determine our namespace ID and if we are a talkpage.
  62. """
  63. super(Page, self).__init__(site)
  64. self._site = site
  65. self._title = title.strip()
  66. self._follow_redirects = self._keep_following = follow_redirects
  67. self._exists = 0
  68. self._pageid = None
  69. self._is_redirect = None
  70. self._lastrevid = None
  71. self._protection = None
  72. self._fullurl = None
  73. self._content = None
  74. self._creator = None
  75. # Attributes used for editing/deleting/protecting/etc:
  76. self._token = None
  77. self._basetimestamp = None
  78. self._starttimestamp = None
  79. # Try to determine the page's namespace using our site's namespace
  80. # converter:
  81. prefix = self._title.split(":", 1)[0]
  82. if prefix != title: # ignore a page that's titled "Category" or "User"
  83. try:
  84. self._namespace = self._site.namespace_name_to_id(prefix)
  85. except NamespaceNotFoundError:
  86. self._namespace = 0
  87. else:
  88. self._namespace = 0
  89. # Is this a talkpage? Talkpages have odd IDs, while content pages have
  90. # even IDs, excluding the "special" namespaces:
  91. if self._namespace < 0:
  92. self._is_talkpage = False
  93. else:
  94. self._is_talkpage = self._namespace % 2 == 1
  95. def __repr__(self):
  96. """Returns the canonical string representation of the Page."""
  97. res = "Page(title={0!r}, follow_redirects={1!r}, site={2!r})"
  98. return res.format(self._title, self._follow_redirects, self._site)
  99. def __str__(self):
  100. """Returns a nice string representation of the Page."""
  101. return '<Page "{0}" of {1}>'.format(self.title(), str(self._site))
  102. def _force_validity(self):
  103. """Used to ensure that our page's title is valid.
  104. If this method is called when our page is not valid (and after
  105. _load_attributes() has been called), InvalidPageError will be raised.
  106. Note that validity != existence. If a page's title is invalid (e.g, it
  107. contains "[") it will always be invalid, and cannot be edited.
  108. """
  109. if self._exists == 1:
  110. e = "Page '{0}' is invalid.".format(self._title)
  111. raise InvalidPageError(e)
  112. def _force_existence(self):
  113. """Used to ensure that our page exists.
  114. If this method is called when our page doesn't exist (and after
  115. _load_attributes() has been called), PageNotFoundError will be raised.
  116. It will also call _force_validity() beforehand.
  117. """
  118. self._force_validity()
  119. if self._exists == 2:
  120. e = "Page '{0}' does not exist.".format(self._title)
  121. raise PageNotFoundError(e)
  122. def _load_wrapper(self):
  123. """Calls _load_attributes() and follows redirects if we're supposed to.
  124. This method will only follow redirects if follow_redirects=True was
  125. passed to __init__() (perhaps indirectly passed by site.get_page()).
  126. It avoids the API's &redirects param in favor of manual following,
  127. so we can act more realistically (we don't follow double redirects, and
  128. circular redirects don't break us).
  129. This will raise RedirectError if we have a problem following, but that
  130. is a bug and should NOT happen.
  131. If we're following a redirect, this will make a grand total of three
  132. API queries. It's a lot, but each one is quite small.
  133. """
  134. self._load_attributes()
  135. if self._keep_following and self._is_redirect:
  136. self._title = self.get_redirect_target()
  137. self._keep_following = False # don't follow double redirects
  138. self._content = None # reset the content we just loaded
  139. self._load_attributes()
  140. def _load_attributes(self, result=None):
  141. """Loads various data from the API in a single query.
  142. Loads self._title, ._exists, ._is_redirect, ._pageid, ._fullurl,
  143. ._protection, ._namespace, ._is_talkpage, ._creator, ._lastrevid,
  144. ._token, and ._starttimestamp using the API. It will do a query of
  145. its own unless `result` is provided, in which case we'll pretend
  146. `result` is what the query returned.
  147. Assuming the API is sound, this should not raise any exceptions.
  148. """
  149. if not result:
  150. params = {"action": "query", "rvprop": "user", "intoken": "edit",
  151. "prop": "info|revisions", "rvlimit": 1, "rvdir": "newer",
  152. "titles": self._title, "inprop": "protection|url"}
  153. result = self._site._api_query(params)
  154. res = result["query"]["pages"].values()[0]
  155. # Normalize our pagename/title thing:
  156. self._title = res["title"]
  157. try:
  158. res["redirect"]
  159. except KeyError:
  160. self._is_redirect = False
  161. else:
  162. self._is_redirect = True
  163. self._pageid = result["query"]["pages"].keys()[0]
  164. if int(self._pageid) < 0:
  165. try:
  166. res["missing"]
  167. except KeyError:
  168. # If it has a negative ID and it's invalid, then break here,
  169. # because there's no other data for us to get:
  170. self._exists = 1
  171. return
  172. else:
  173. # If it has a negative ID and it's missing; we can still get
  174. # data like the namespace, protection, and URL:
  175. self._exists = 2
  176. else:
  177. self._exists = 3
  178. self._fullurl = res["fullurl"]
  179. self._protection = res["protection"]
  180. try:
  181. self._token = res["edittoken"]
  182. except KeyError:
  183. pass
  184. else:
  185. self._starttimestamp = strftime("%Y-%m-%dT%H:%M:%SZ", gmtime())
  186. # We've determined the namespace and talkpage status in __init__()
  187. # based on the title, but now we can be sure:
  188. self._namespace = res["ns"]
  189. self._is_talkpage = self._namespace % 2 == 1 # talkpages have odd IDs
  190. # These last two fields will only be specified if the page exists:
  191. self._lastrevid = res.get("lastrevid")
  192. try:
  193. self._creator = res['revisions'][0]['user']
  194. except KeyError:
  195. pass
  196. def _load_content(self, result=None):
  197. """Loads current page content from the API.
  198. If `result` is provided, we'll pretend that is the result of an API
  199. query and try to get content from that. Otherwise, we'll do an API
  200. query on our own.
  201. Don't call this directly, ever - use .get(force=True) if you want to
  202. force content reloading.
  203. """
  204. if not result:
  205. params = {"action": "query", "prop": "revisions", "rvlimit": 1,
  206. "rvprop": "content|timestamp", "titles": self._title}
  207. result = self._site._api_query(params)
  208. res = result["query"]["pages"].values()[0]
  209. try:
  210. self._content = res["revisions"][0]["*"]
  211. self._basetimestamp = res["revisions"][0]["timestamp"]
  212. except KeyError:
  213. # This can only happen if the page was deleted since we last called
  214. # self._load_attributes(). In that case, some of our attributes are
  215. # outdated, so force another self._load_attributes():
  216. self._load_attributes()
  217. self._force_existence()
  218. def _edit(self, params=None, text=None, summary=None, minor=None, bot=None,
  219. force=None, section=None, captcha_id=None, captcha_word=None,
  220. tries=0):
  221. """Edit the page!
  222. If `params` is given, we'll use it as our API query parameters.
  223. Otherwise, we'll build params using the given kwargs via
  224. _build_edit_params().
  225. We'll then try to do the API query, and catch any errors the API raises
  226. in _handle_edit_errors(). We'll then throw these back as subclasses of
  227. EditError.
  228. """
  229. # Try to get our edit token, and die if we can't:
  230. if not self._token:
  231. self._load_attributes()
  232. if not self._token:
  233. e = "You don't have permission to edit this page."
  234. raise PermissionsError(e)
  235. # Weed out invalid pages before we get too far:
  236. self._force_validity()
  237. # Build our API query string:
  238. if not params:
  239. params = self._build_edit_params(text, summary, minor, bot, force,
  240. section, captcha_id, captcha_word)
  241. else: # Make sure we have the right token:
  242. params["token"] = self._token
  243. # Try the API query, catching most errors with our handler:
  244. try:
  245. result = self._site._api_query(params)
  246. except SiteAPIError as error:
  247. if not hasattr(error, "code"):
  248. raise # We can only handle errors with a code attribute
  249. result = self._handle_edit_errors(error, params, tries)
  250. # If everything was successful, reset invalidated attributes:
  251. if result["edit"]["result"] == "Success":
  252. self._content = None
  253. self._basetimestamp = None
  254. self._exists = 0
  255. return
  256. # If we're here, then the edit failed. If it's because of AssertEdit,
  257. # handle that. Otherwise, die - something odd is going on:
  258. try:
  259. assertion = result["edit"]["assert"]
  260. except KeyError:
  261. raise EditError(result["edit"])
  262. self._handle_assert_edit(assertion, params, tries)
  263. def _build_edit_params(self, text, summary, minor, bot, force, section,
  264. captcha_id, captcha_word):
  265. """Given some keyword arguments, build an API edit query string."""
  266. hashed = md5(text).hexdigest() # Checksum to ensure text is correct
  267. params = {"action": "edit", "title": self._title, "text": text,
  268. "token": self._token, "summary": summary, "md5": hashed}
  269. if section:
  270. params["section"] = section
  271. if captcha_id and captcha_word:
  272. params["captchaid"] = captcha_id
  273. params["captchaword"] = captcha_word
  274. if minor:
  275. params["minor"] = "true"
  276. else:
  277. params["notminor"] = "true"
  278. if bot:
  279. params["bot"] = "true"
  280. if not force:
  281. params["starttimestamp"] = self._starttimestamp
  282. if self._basetimestamp:
  283. params["basetimestamp"] = self._basetimestamp
  284. if self._exists == 2:
  285. # Page does not exist; don't edit if it already exists:
  286. params["createonly"] = "true"
  287. else:
  288. params["recreate"] = "true"
  289. return params
  290. def _handle_edit_errors(self, error, params, tries):
  291. """If our edit fails due to some error, try to handle it.
  292. We'll either raise an appropriate exception (for example, if the page
  293. is protected), or we'll try to fix it (for example, if we can't edit
  294. due to being logged out, we'll try to log in).
  295. """
  296. if error.code in ["noedit", "cantcreate", "protectedtitle",
  297. "noimageredirect"]:
  298. raise PermissionsError(error.info)
  299. elif error.code in ["noedit-anon", "cantcreate-anon",
  300. "noimageredirect-anon"]:
  301. if not all(self._site._login_info):
  302. # Insufficient login info:
  303. raise PermissionsError(error.info)
  304. if tries == 0:
  305. # We have login info; try to login:
  306. self._site._login(self._site._login_info)
  307. self._token = None # Need a new token; old one is invalid now
  308. return self._edit(params=params, tries=1)
  309. else:
  310. # We already tried to log in and failed!
  311. e = "Although we should be logged in, we are not. This may be a cookie problem or an odd bug."
  312. raise LoginError(e)
  313. elif error.code in ["editconflict", "pagedeleted", "articleexists"]:
  314. # These attributes are now invalidated:
  315. self._content = None
  316. self._basetimestamp = None
  317. self._exists = 0
  318. raise EditConflictError(error.info)
  319. elif error.code in ["emptypage", "emptynewsection"]:
  320. raise NoContentError(error.info)
  321. elif error.code == "contenttoobig":
  322. raise ContentTooBigError(error.info)
  323. elif error.code == "spamdetected":
  324. raise SpamDetectedError(error.info)
  325. elif error.code == "filtered":
  326. raise FilteredError(error.info)
  327. raise EditError(": ".join((error.code, error.info)))
  328. def _handle_assert_edit(self, assertion, params, tries):
  329. """If we can't edit due to a failed AssertEdit assertion, handle that.
  330. If the assertion was 'user' and we have valid login information, try to
  331. log in. Otherwise, raise PermissionsError with details.
  332. """
  333. if assertion == "user":
  334. if not all(self._site._login_info):
  335. # Insufficient login info:
  336. e = "AssertEdit: user assertion failed, and no login info was provided."
  337. raise PermissionsError(e)
  338. if tries == 0:
  339. # We have login info; try to login:
  340. self._site._login(self._site._login_info)
  341. self._token = None # Need a new token; old one is invalid now
  342. return self._edit(params=params, tries=1)
  343. else:
  344. # We already tried to log in and failed!
  345. e = "Although we should be logged in, we are not. This may be a cookie problem or an odd bug."
  346. raise LoginError(e)
  347. elif assertion == "bot":
  348. e = "AssertEdit: bot assertion failed; we don't have a bot flag!"
  349. raise PermissionsError(e)
  350. # Unknown assertion, maybe "true", "false", or "exists":
  351. e = "AssertEdit: assertion '{0}' failed.".format(assertion)
  352. raise PermissionsError(e)
  353. def title(self, force=False):
  354. """Returns the Page's title, or pagename.
  355. This won't do any API queries on its own unless force is True, in which
  356. case the title will be forcibly reloaded from the API (normalizing it,
  357. and following redirects if follow_redirects=True was passed to
  358. __init__()). Any other methods that do API queries will reload title on
  359. their own, however, like exists() and get().
  360. """
  361. if force:
  362. self._load_wrapper()
  363. return self._title
  364. def exists(self, force=False):
  365. """Returns information about whether the Page exists or not.
  366. The returned "information" is a tuple with two items. The first is a
  367. bool, either True if the page exists or False if it does not. The
  368. second is a string giving more information, either "invalid", (title
  369. is invalid, e.g. it contains "["), "missing", or "exists".
  370. Makes an API query if force is True or if we haven't already made one.
  371. """
  372. cases = {
  373. 0: (None, "unknown"),
  374. 1: (False, "invalid"),
  375. 2: (False, "missing"),
  376. 3: (True, "exists"),
  377. }
  378. if self._exists == 0 or force:
  379. self._load_wrapper()
  380. return cases[self._exists]
  381. def pageid(self, force=False):
  382. """Returns an integer ID representing the Page.
  383. Makes an API query if force is True or if we haven't already made one.
  384. Raises InvalidPageError or PageNotFoundError if the page name is
  385. invalid or the page does not exist, respectively.
  386. """
  387. if self._exists == 0 or force:
  388. self._load_wrapper()
  389. self._force_existence() # missing pages do not have IDs
  390. return self._pageid
  391. def url(self, force=False):
  392. """Returns the page's URL.
  393. Like title(), this won't do any API queries on its own unless force is
  394. True. If the API was never queried for this page, we will attempt to
  395. determine the URL ourselves based on the title.
  396. """
  397. if force:
  398. self._load_wrapper()
  399. if self._fullurl:
  400. return self._fullurl
  401. else:
  402. slug = quote(self._title.replace(" ", "_"), safe="/:")
  403. path = self._site._article_path.replace("$1", slug)
  404. return ''.join((self._site._base_url, path))
  405. def namespace(self, force=False):
  406. """Returns the page's namespace ID (an integer).
  407. Like title(), this won't do any API queries on its own unless force is
  408. True. If the API was never queried for this page, we will attempt to
  409. determine the namespace ourselves based on the title.
  410. """
  411. if force:
  412. self._load_wrapper()
  413. return self._namespace
  414. def protection(self, force=False):
  415. """Returns the page's current protection status.
  416. Makes an API query if force is True or if we haven't already made one.
  417. Raises InvalidPageError if the page name is invalid. Will not raise an
  418. error if the page is missing because those can still be protected.
  419. """
  420. if self._exists == 0 or force:
  421. self._load_wrapper()
  422. self._force_validity() # invalid pages cannot be protected
  423. return self._protection
  424. def creator(self, force=False):
  425. """Returns the page's creator (i.e., the first user to edit the page).
  426. Makes an API query if force is True or if we haven't already made one.
  427. Normally, we can get the creator along with everything else (except
  428. content) in self._load_attributes(). However, due to a limitation in
  429. the API (can't get the editor of one revision and the content of
  430. another at both ends of the history), if our other attributes were only
  431. loaded from get(), we'll have to do another API query. This is done
  432. by calling ourselves again with force=True.
  433. Raises InvalidPageError or PageNotFoundError if the page name is
  434. invalid or the page does not exist, respectively.
  435. """
  436. if self._exists == 0 or force:
  437. self._load_wrapper()
  438. self._force_existence()
  439. if not self._creator and not force:
  440. self.creator(force=True)
  441. return self._creator
  442. def is_talkpage(self, force=False):
  443. """Returns True if the page is a talkpage, else False.
  444. Like title(), this won't do any API queries on its own unless force is
  445. True. If the API was never queried for this page, we will attempt to
  446. determine the talkpage status ourselves based on its namespace ID.
  447. """
  448. if force:
  449. self._load_wrapper()
  450. return self._is_talkpage
  451. def is_redirect(self, force=False):
  452. """Returns True if the page is a redirect, else False.
  453. Makes an API query if force is True or if we haven't already made one.
  454. We will return False even if the page does not exist or is invalid.
  455. """
  456. if self._exists == 0 or force:
  457. self._load_wrapper()
  458. return self._is_redirect
  459. def toggle_talk(self, force=False, follow_redirects=None):
  460. """Returns a content page's talk page, or vice versa.
  461. The title of the new page is determined by namespace logic, not API
  462. queries. We won't make any API queries on our own unless force is True,
  463. and the only reason then would be to forcibly update the title or
  464. follow redirects if we haven't already made an API query.
  465. If `follow_redirects` is anything other than None (the default), it
  466. will be passed to the new Page's __init__(). Otherwise, we'll use the
  467. value passed to our own __init__().
  468. Will raise InvalidPageError if we try to get the talk page of a special
  469. page (in the Special: or Media: namespaces), but we won't raise an
  470. exception if our page is otherwise missing or invalid.
  471. """
  472. if force:
  473. self._load_wrapper()
  474. if self._namespace < 0:
  475. ns = self._site.namespace_id_to_name(self._namespace)
  476. e = "Pages in the {0} namespace can't have talk pages.".format(ns)
  477. raise InvalidPageError(e)
  478. if self._is_talkpage:
  479. new_ns = self._namespace - 1
  480. else:
  481. new_ns = self._namespace + 1
  482. try:
  483. body = self._title.split(":", 1)[1]
  484. except IndexError:
  485. body = self._title
  486. new_prefix = self._site.namespace_id_to_name(new_ns)
  487. # If the new page is in namespace 0, don't do ":Title" (it's correct,
  488. # but unnecessary), just do "Title":
  489. if new_prefix:
  490. new_title = ':'.join((new_prefix, body))
  491. else:
  492. new_title = body
  493. if follow_redirects is None:
  494. follow_redirects = self._follow_redirects
  495. return Page(self._site, new_title, follow_redirects)
  496. def get(self, force=False):
  497. """Returns page content, which is cached if you try to call get again.
  498. Use `force` to forcibly reload page content even if we've already
  499. loaded some. This is good if you want to edit a page multiple times,
  500. and you want to get updated content before you make your second edit.
  501. Raises InvalidPageError or PageNotFoundError if the page name is
  502. invalid or the page does not exist, respectively.
  503. """
  504. if force or self._exists == 0:
  505. # Kill two birds with one stone by doing an API query for both our
  506. # attributes and our page content:
  507. params = {"action": "query", "rvlimit": 1, "titles": self._title,
  508. "prop": "info|revisions", "inprop": "protection|url",
  509. "intoken": "edit", "rvprop": "content|timestamp"}
  510. result = self._site._api_query(params)
  511. self._load_attributes(result=result)
  512. self._force_existence()
  513. self._load_content(result=result)
  514. # Follow redirects if we're told to:
  515. if self._keep_following and self._is_redirect:
  516. self._title = self.get_redirect_target()
  517. self._keep_following = False # don't follow double redirects
  518. self._content = None # reset the content we just loaded
  519. self.get(force=True)
  520. return self._content
  521. # Make sure we're dealing with a real page here. This may be outdated
  522. # if the page was deleted since we last called self._load_attributes(),
  523. # but self._load_content() can handle that:
  524. self._force_existence()
  525. if self._content is None:
  526. self._load_content()
  527. return self._content
  528. def get_redirect_target(self, force=False):
  529. """If the page is a redirect, returns its destination.
  530. Use `force` to forcibly reload content even if we've already loaded
  531. some before. Note that this method calls get() for page content.
  532. Raises InvalidPageError or PageNotFoundError if the page name is
  533. invalid or the page does not exist, respectively. Raises RedirectError
  534. if the page is not a redirect.
  535. """
  536. content = self.get(force)
  537. try:
  538. return re.findall(self.re_redirect, content, flags=re.I)[0]
  539. except IndexError:
  540. e = "The page does not appear to have a redirect target."
  541. raise RedirectError(e)
  542. def edit(self, text, summary, minor=False, bot=True, force=False):
  543. """Replaces the page's content or creates a new page.
  544. `text` is the new page content, with `summary` as the edit summary.
  545. If `minor` is True, the edit will be marked as minor. If `bot` is true,
  546. the edit will be marked as a bot edit, but only if we actually have a
  547. bot flag.
  548. Use `force` to push the new content even if there's an edit conflict or
  549. the page was deleted/recreated between getting our edit token and
  550. editing our page. Be careful with this!
  551. """
  552. self._edit(text=text, summary=summary, minor=minor, bot=bot,
  553. force=force)
  554. def add_section(self, text, title, minor=False, bot=True, force=False):
  555. """Adds a new section to the bottom of the page.
  556. The arguments for this are the same as those for edit(), but instead of
  557. providing a summary, you provide a section title.
  558. Likewise, raised exceptions are the same as edit()'s.
  559. This should create the page if it does not already exist, with just the
  560. new section as content.
  561. """
  562. self._edit(text=text, summary=title, minor=minor, bot=bot, force=force,
  563. section="new")