1919from  pydantic  import  FilePath 
2020from  typing_extensions  import  deprecated 
2121
22- import  osw .model .entity  as  model 
2322import  osw .model .page_package  as  package 
2423import  osw .utils .util  as  ut 
2524import  osw .wiki_tools  as  wt 
@@ -180,7 +179,7 @@ def from_credentials(
180179        site  =  wt .create_site_object (_domain , "" , _credentials )
181180        return  cls (WtSite .WtSiteLegacyConfig (site = site ))
182181
183-     class  GetPageParam (model . OswBaseModel ):
182+     class  GetPageParam (OswBaseModel ):
184183        titles : Union [str , List [str ]]
185184        """title string or list of title strings of the pages to download""" 
186185        parallel : Optional [bool ] =  None 
@@ -202,7 +201,7 @@ def __init__(self, **data):
202201            if  self .parallel  is  None :
203202                self .parallel  =  False 
204203
205-     class  GetPageResult (model . OswBaseModel ):
204+     class  GetPageResult (OswBaseModel ):
206205        pages : List ["WtPage" ]
207206        """List of pages that have been downloaded""" 
208207        errors : List [Exception ]
@@ -275,7 +274,7 @@ def get_WtPage(self, title: str = None):
275274        result  =  self .get_page (WtSite .GetPageParam (titles = title ))
276275        return  result .pages [0 ]
277276
278-     class  GetPageContentResult (model . OswBaseModel ):
277+     class  GetPageContentResult (OswBaseModel ):
279278        contents : dict 
280279        """The content of the pages. Keys are page titles, values are 
281280        content dictionaries""" 
@@ -362,7 +361,7 @@ def semantic_search(self, query: Union[str, wt.SearchParam]):
362361        """ 
363362        return  wt .semantic_search (self ._site , query )
364363
365-     class  ModifySearchResultsParam (model . OswBaseModel ):
364+     class  ModifySearchResultsParam (OswBaseModel ):
366365        """Todo: should become param of modify_search_results""" 
367366
368367        mode : str 
@@ -429,7 +428,7 @@ def modify_search_results(
429428            if  not  dryrun :
430429                wtpage .edit (comment )
431430
432-     class  UploadPageParam (model . OswBaseModel ):
431+     class  UploadPageParam (OswBaseModel ):
433432        """Parameter object for upload_page method.""" 
434433
435434        pages : Union ["WtPage" , List ["WtPage" ]]
@@ -490,7 +489,7 @@ def upload_page_(page, index: int = None):
490489        else :
491490            _  =  [upload_page_ (p , i ) for  i , p  in  enumerate (param .pages )]
492491
493-     class  CopyPagesParam (model . OswBaseModel ):
492+     class  CopyPagesParam (OswBaseModel ):
494493        """Configuration to copy several page""" 
495494
496495        source_site : "WtSite" 
@@ -545,7 +544,7 @@ def copy_single_page(content_dict: dict):
545544        else :
546545            return  [copy_single_page (content ) for  content  in  content_list ]
547546
548-     class  CreatePagePackageParam (model . OswBaseModel ):
547+     class  CreatePagePackageParam (OswBaseModel ):
549548        """Parameter object for create_page_package method.""" 
550549
551550        config : package .PagePackageConfig 
@@ -630,7 +629,7 @@ def create_page_package(self, param: CreatePagePackageParam):
630629        with  open (file_name , "w" , encoding = "utf-8" ) as  f :
631630            f .write (content )
632631
633-     class  ReadPagePackageParam (model . OswBaseModel ):
632+     class  ReadPagePackageParam (OswBaseModel ):
634633        """Parameter type of read_page_package.""" 
635634
636635        storage_path : Union [str , Path ]
@@ -643,7 +642,7 @@ class ReadPagePackageParam(model.OswBaseModel):
643642        debug : Optional [bool ] =  False 
644643        """If True, debug information is printed to the console.""" 
645644
646-     class  ReadPagePackageResult (model . OswBaseModel ):
645+     class  ReadPagePackageResult (OswBaseModel ):
647646        """Return type of read_page_package.""" 
648647
649648        pages : List ["WtPage" ]
@@ -786,7 +785,7 @@ def get_slot_content(
786785                pages .append (page_obj )
787786        return  WtSite .ReadPagePackageResult (pages = pages )
788787
789-     class  UploadPagePackageParam (model . OswBaseModel ):
788+     class  UploadPagePackageParam (OswBaseModel ):
790789        """Parameter class for upload_page_package method.""" 
791790
792791        storage_path : Optional [Union [str , Path ]] =  None 
@@ -1256,6 +1255,7 @@ def _edit(self, comment: str = None, mode="action-multislot"):
12561255                            content  =  json .dumps (content , ensure_ascii = False )
12571256                    params ["slot_"  +  slot_key ] =  content 
12581257            if  changed :
1258+                 self .changed  =  True 
12591259                self .wtSite ._site .api (
12601260                    "editslots" ,
12611261                    token = self .wtSite ._site .get_token ("csrf" ),
@@ -1266,8 +1266,10 @@ def _edit(self, comment: str = None, mode="action-multislot"):
12661266                self .wtSite ._clear_cookies ()
12671267
12681268        else :
1269+             changed  =  False 
12691270            for  slot_key  in  self ._slots :
12701271                if  self ._slots_changed [slot_key ]:
1272+                     changed  =  True 
12711273                    content  =  self ._slots [slot_key ]
12721274                    if  self ._content_model [slot_key ] ==  "json" :
12731275                        content  =  json .dumps (content , ensure_ascii = False )
@@ -1280,6 +1282,8 @@ def _edit(self, comment: str = None, mode="action-multislot"):
12801282                        summary = comment ,
12811283                    )
12821284                    self ._slots_changed [slot_key ] =  False 
1285+             if  changed :
1286+                 self .changed  =  True 
12831287
12841288    def  delete (self , comment : str  =  None ):
12851289        """Deletes the page from the site 
@@ -1321,7 +1325,7 @@ def get_last_changed_time(self):
13211325            self ._current_revision ["timestamp" ].replace ("Z" , "+00:00" )
13221326        )
13231327
1324-     class  CopyPageConfig (model . OswBaseModel ):
1328+     class  CopyPageConfig (OswBaseModel ):
13251329        """Configuration to copy a page""" 
13261330
13271331        source_site : WtSite 
@@ -1337,7 +1341,7 @@ class CopyPageConfig(model.OswBaseModel):
13371341        class  Config :
13381342            arbitrary_types_allowed  =  True 
13391343
1340-     class  PageCopyResult (model . OswBaseModel ):
1344+     class  PageCopyResult (OswBaseModel ):
13411345        """Result of copying a page""" 
13421346
13431347        page : "WtPage" 
@@ -1389,7 +1393,7 @@ def copy(self, config: CopyPageConfig) -> PageCopyResult:
13891393            print (s2p )
13901394            return  WtPage .PageCopyResult (page = self , target_altered = True )
13911395
1392-     class  PageDumpConfig (model . OswBaseModel ):
1396+     class  PageDumpConfig (OswBaseModel ):
13931397        """Configuration to dump wiki pages to the file system""" 
13941398
13951399        target_dir : Union [str , Path ]
@@ -1549,15 +1553,15 @@ def purge(self):
15491553        """ 
15501554        self ._page .purge ()
15511555
1552-     class  ExportConfig (model . OswBaseModel ):
1556+     class  ExportConfig (OswBaseModel ):
15531557        """Configuration to export a page to XML""" 
15541558
15551559        full_history : Optional [bool ] =  True 
15561560        """if true, export the full history of the page, else only the current revision""" 
15571561        include_templates : Optional [bool ] =  False 
15581562        """if true, export the templates used in the page""" 
15591563
1560-     class  ExportResult (model . OswBaseModel ):
1564+     class  ExportResult (OswBaseModel ):
15611565        """Return type of export_xml""" 
15621566
15631567        xml : str 
@@ -1604,7 +1608,7 @@ def export_xml(
16041608        else :
16051609            return  WtPage .ExportResult (success = True , xml = response .text )
16061610
1607-     class  ImportConfig (model . OswBaseModel ):
1611+     class  ImportConfig (OswBaseModel ):
16081612        """Configuration to import a page from XML. 
16091613        see also https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps""" 
16101614
@@ -1629,7 +1633,7 @@ class ImportConfig(model.OswBaseModel):
16291633        username_mapping : Optional [Dict [str , str ]] =  {}
16301634        """mapping of usernames in the XML to usernames in the target instance""" 
16311635
1632-     class  ImportResult (model . OswBaseModel ):
1636+     class  ImportResult (OswBaseModel ):
16331637        """Return type of import_xml""" 
16341638
16351639        success : bool 
0 commit comments