A
A
Alexander2016-04-15 08:13:57
Python
Alexander, 2016-04-15 08:13:57

Am I doing OOP correctly?

I am writing my library for working with images. Haven't added all the features yet.
I would like to hear criticism from professional developers on my code, maybe where something is wrong or where it could be easier to do, since I'm a beginner
https://gist.github.com/kentuck13/2079114d28fe4019...
Upload.save_files call (image, 'product', new_obj.id)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JRazor, 2016-04-17
@kentuck1213

Small remarks on the code:
1) path = Upload.get_path(folder_name, id)
You are using class calls in a slightly different way within itself. Read about self :
2) Why do you need so many @staticmethod? Remove everything except get_path, substitute self everywhere and read the first note.
3) from poliv.settings. Why not from poliv.nastroiki?
4) get_files, return images. Read about yield
5) Use at least numbers for format, but rather name it:

"""<img src="{image}" style="max-width: 250px; width:100%" class="{class}">""".format(
    image=images_path + file, class=i_class)

And yes, why do you need triple quotes?
6) If you want your class to work not only on your system, use os.path.join instead of +

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question