Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def objects():
aType = Instantiator('attestations.AttestationType', "name").build
yield aType(_("Default"), build_method='appyodt', template='Default.odt')
def get_data_rows(self, ar):
flt = ar.param_values.filter
build = Instantiator(flt.content_type.model_class()).build
for ln in ar.param_values.data.splitlines():
ln = ln.strip()
if ln:
kw = dict()
cells = flt.field_sep.split(ln)
for item in flt.item_set.all():
if item.column:
kw[item.field] = cells[item.column-1]
yield build(**kw)
if isinstance(stream_or_string, six.string_types):
stream = StringIO(stream_or_string)
else:
stream = stream_or_string
model_builder = None
for values in yaml.load_all(stream):
if 'model' in values:
modelspec = values.pop('model')
#model_class = eval(modelspec)
app, model = modelspec.split(".")
# print app,model
model_class = models.get_model(app, model)
if not model_class:
raise Exception("invalid model:" + modelspec)
model_builder = Instantiator(model_class)
if model_builder is None:
raise DataError("No model specified")
# print model_class
instance = model_builder.build(**values)
# yield instance
#~ if model_class == User:
#~ instance.set_password(yamldict.get('password'))
# data files are required to use "!!python/object:", so the
# yamldict is a Python object
# self.add_node(yamldict)
# print instance.pk, instance
#~ instance.save()
#~ m2m_data = {}
yield FakeDeserializedObject(instance)
## You should have received a copy of the GNU General Public License
## along with Lino; if not, write to the Free Software Foundation,
## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import time
from datetime import date
from dateutil import parser as dateparser
from lino.ledger.models import *
from lino.utils.instantiator import Instantiator
from lino.utils import journals
def i2d(i):
return dateparser.parse(str(i))
account = Instantiator(Account,"name").build
def objects():
BANK = journals.create_journal("BANK",FinancialDocument)
EL = account("Electricity")
IN = account("Internet")
CU = account("Customers")
PR = account("Providers")
doc = BANK.create_document(creation_date=i2d(20090501))
doc.add_item(account=PR,contact=Contact.objects.get(pk=2),
debit='12.49')
return [ BANK, EL, IN, CU, PR, doc ]
en=u"Internal meetings with client",
))
yield et
#~ et = Calendar(**babel_values('name',
#~ de=u'Auswertungen',
#~ fr=u"Evaluations",
#~ en=u"Evaluations",
#~ ))
exam_policy = Instantiator('isip.ExamPolicy','every',every_unit=DurationUnits.months).build
yield exam_policy(1,calendar=et,start_time="9:00",**babel_values('name',en='every month',de='monatlich',fr="mensuel"))
yield exam_policy(2,calendar=et,start_time="9:00",**babel_values('name',en='every 2 months',de='zweimonatlich',fr="bimensuel"))
yield exam_policy(3,calendar=et,start_time="9:00",**babel_values('name',en='every 3 months',de='alle 3 Monate',fr="tous les 3 mois"))
exam_policy = Instantiator('isip.ExamPolicy','every',every_unit=DurationUnits.weeks).build
yield exam_policy(2,calendar=et,start_time="9:00",**babel_values('name',en='every 2 weeks',de='zweiwöchentlich',fr="hebdomadaire"))
exam_policy = Instantiator('isip.ExamPolicy').build
yield exam_policy(0,**babel_values('name',en='other',de='andere',fr="autre"))
#~ def create_dsbe_aidtype(id,name,name_fr):
#~ return AidType(id=id,name=name,name_fr=name_fr)
aidtype = Instantiator('pcsw.AidType').build
yield aidtype(**babel_values('name',
de=u'Eingliederungseinkommen Kat 1 (Zusammenlebend)',
fr=u"Revenu d'intégration cat. 1 (couple)",
en=u"Revenu d'intégration cat. 1 (couple)",
))
yield aidtype(**babel_values('name',
de=u'Eingliederungseinkommen Kat 2 (Alleinlebend)',
fr=u"Revenu d'intégration cat. 2 (célibataire)",
def objects():
HelpText = rt.models.gfks.HelpText
ContentType = rt.models.contenttypes.ContentType
HT = Instantiator(HelpText, "content_type field help_text").build
yield HT(ContentType.objects.get_for_model(HelpText),
'field', "The name of the field.")
yield et
#~ et = Calendar(**babel_values('name',
#~ de=u'Auswertungen',
#~ fr=u"Evaluations",
#~ en=u"Evaluations",
#~ ))
exam_policy = Instantiator('isip.ExamPolicy','every',every_unit=DurationUnits.months).build
yield exam_policy(1,calendar=et,start_time="9:00",**babel_values('name',en='every month',de='monatlich',fr="mensuel"))
yield exam_policy(2,calendar=et,start_time="9:00",**babel_values('name',en='every 2 months',de='zweimonatlich',fr="bimensuel"))
yield exam_policy(3,calendar=et,start_time="9:00",**babel_values('name',en='every 3 months',de='alle 3 Monate',fr="tous les 3 mois"))
exam_policy = Instantiator('isip.ExamPolicy','every',every_unit=DurationUnits.weeks).build
yield exam_policy(2,calendar=et,start_time="9:00",**babel_values('name',en='every 2 weeks',de='zweiwöchentlich',fr="hebdomadaire"))
exam_policy = Instantiator('isip.ExamPolicy').build
yield exam_policy(0,**babel_values('name',en='other',de='andere',fr="autre"))
#~ def create_dsbe_aidtype(id,name,name_fr):
#~ return AidType(id=id,name=name,name_fr=name_fr)
aidtype = Instantiator('pcsw.AidType').build
yield aidtype(**babel_values('name',
de=u'Eingliederungseinkommen Kat 1 (Zusammenlebend)',
fr=u"Revenu d'intégration cat. 1 (couple)",
en=u"Revenu d'intégration cat. 1 (couple)",
))
yield aidtype(**babel_values('name',
de=u'Eingliederungseinkommen Kat 2 (Alleinlebend)',
fr=u"Revenu d'intégration cat. 2 (célibataire)",
en=u"Revenu d'intégration cat. 2 (célibataire)",
))
yield eventType(u"Kontakt ÖSHZ intern","Kontakte mit Kollegen oder Diensten im ÖSHZ, z.B. Fallbesprechung mit Allgemeinem Sozialdienst, Energieberatung, Schuldnerberatung, Sekretariat, ...")
yield eventType(u"Telefonat","Telefonischer Kontakt mit dem Kunden, anderen Personen, Diensten oder Organisationen ....")
#~ projectType = Instantiator('projects.ProjectType',"name").build
#~ yield projectType(u"VSE Ausbildung")
#~ yield projectType(u"VSE Arbeitssuche")
#~ yield projectType(u"VSE Integration")
#~ yield projectType(u"Hausinterne Arbeitsverträge")
#~ yield projectType(u"Externe Arbeitsverträge")
#~ yield projectType(u"Kurse und Zusatzausbildungen")
#~ yield projectType(u"Sozialhilfe")
#~ yield projectType(u"EiEi")
#~ yield projectType(u"Aufenthaltsgenehmigung")
studyType = Instantiator('jobs.StudyType').build
#~ yield studyType(u"Schule")
#~ yield studyType(u"Sonderschule")
#~ yield studyType(u"Ausbildung")
#~ yield studyType(u"Lehre")
#~ yield studyType(u"Hochschule")
#~ yield studyType(u"Universität")
#~ yield studyType(u"Teilzeitunterricht")
#~ yield studyType(u"Fernkurs")
yield studyType(**babel_values('name',
de=u"Schule",
fr=u"École",
en=u"School",
))
yield studyType(**babel_values('name',
de=u"Sonderschule",
fr=u"École spéciale",
))
yield g
account = Instantiator('debts.Account', group=g, periods=12).build
yield account(required_for_household=True, **dd.babel_values('name',
de=u"Müllsteuer",
fr=u"Taxe déchets",
en=u"Waste tax"
))
g = group(account_type=AccountType.asset, **dd.babel_values('name',
de=u"Aktiva, Vermögen, Kapital",
fr=u"Actifs",
en=u"Assets"
))
yield g
account = Instantiator('debts.Account', group=g).build
yield account(**dd.babel_values('name',
de=u"Vermögen",
fr=u"Propriété",
en=u"Assets"
))
account = Instantiator('debts.Account', group=g).build
yield account(**dd.babel_values('name',
de=u"Haus",
fr=u"Maison",
en=u"House"
))
yield account(**dd.babel_values('name',
de=u"Auto",
fr=u"Voiture",
en=u"Car"
))
def objects():
group = Instantiator('debts.AccountGroup').build
g = group(account_type=AccountType.income, **dd.babel_values('name',
de=u"Monatliche Einkünfte",
fr=u"Revenus mensuels",
en=u"Monthly incomes"
))
yield g
account = Instantiator('debts.Account', group=g).build
yield account(required_for_person=True, **dd.babel_values('name',
de=u"Gehälter",
fr=u"Salaires",
en=u"Salaries"
))
yield account(required_for_person=True, **dd.babel_values('name',
de=u"Renten",
fr=u"Pension",
en=u"Pension"