Meilenstein Ein beendet // Woche 5


Week #5 19/06 to 25/06

The first evaluation is here, got done with a milestone and took a small break for a personal event.

What did you do this week?

This week I had to attend a marriage and hence took a leave from work. I informed my mentors early of my absence from 23th to 25th June, did the work for the week early and now writing the blog post. 

This week, I finished implementing the validate method of Cerberus finally, previously I did the mistake of not implementing through the previous pipeline, hence it was returning the wrong output. Here’s a snippet of its correct working. 

> from spidermon.contrib.validation.cerberus.validator import CerberusValidator
>> validator = CerberusValidator({‘number’: {‘type’: ‘number’}, ‘name’: {‘type’: ‘string’}})

>> validator.validate({“name”: “sda”,”number”:9})
(True, defaultdict(<class ‘list’>, {}))

>> validator.validate({“price”:59,”name”: 7,”number”:”This is cool”})
(False, defaultdict(<class ‘list’>, {‘name’: [‘must be of string type’], ‘number’: [‘must be of number type’], ‘price’: [‘unknown field’]}))


I learned about defaultdict and @property decorators as well as several things about the existing validator pipeline. Kudos to Renne for having the patience to help me understand it.

What is coming up next? 

Now, we write unittest for the validator following a simple yet effective TDD approach and working towards making the translator of the validator. My college is opening soon and hence would like to get more work done. 

Next, up I am writing a special post about defaultdict as well as Python decorators.

Did you get stuck anywhere?

Yes, working remotely is quite a new experience for me. With GSoC, I often try to make the most of it. Somewhere I feel I am lacking, and need to be more disciplined. I thought for this section, I should at least once to talk physiological rather than problems I am having in my code. Which there is no shortage of at any given moment of time. 

See you all next week if I get through the evaluation, fingers crossed. This is Vipul Gupta signing out!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s