Add Wrapperclass for Parser to RedPage

Add a wrapper class to overwrite type of Items returned by
RedPage.redfams relationship

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=109 FS#109]
This commit is contained in:
2017-03-09 15:30:51 +01:00
parent 76666aa294
commit 147e96d388
2 changed files with 16 additions and 6 deletions

View File

@@ -30,7 +30,8 @@ import mwparserfromhell as mwparser
import jogobot # noqa
from lib.mysqlred import MysqlRedPage
from lib.mysqlred import (
MysqlRedPage, relationship, attribute_mapped_collection )
from lib.redfam import RedFamParser
@@ -131,3 +132,12 @@ class RedPage( MysqlRedPage ):
Calls flush method of Mysql Interface class
"""
cls.session.commit()
class RedPageParser( RedPage ):
"""
Wrapper class to change the type of redfams collection elements in parser
"""
redfams = relationship(
"RedFamParser", enable_typechecks=False, back_populates="redpage",
collection_class=attribute_mapped_collection("famhash") )