Giter Site home page Giter Site logo

Comments (7)

ebzlo avatar ebzlo commented on March 28, 2024

We can modify it to have a filename or file parameter and check to see one or the other exists. It then allows someone working on top of the SDK to be explicit about what they want to pass in.

from facebook-python-business-sdk.

tomako avatar tomako commented on March 28, 2024

Yes, that's a possible way though I would avoid using file as parameter name.
My only concern is the def remote_create_from_zip(cls, filename, parent_id, api=None) because I have to change that to def remote_create_from_zip(cls, filename=None, parent_id=None, api=None, fileobject=None) to keep the current order of parameters.

from facebook-python-business-sdk.

ebzlo avatar ebzlo commented on March 28, 2024

That's a good point @tomako

Open to your thoughts on this suggestion:

The second method signature is definitely not ideal, especially for someone who wants to take advantage of the fileobject parameter without specifying argument names. If we modify ordering we'll create a breaking change for anybody who's not specifying argument names in method calls.

How about we have filename check for object type: string vs object and deal with it appropriately (I realize that's super confusing, but bear with me).

Add an additional parameter to remote_create_from_zip named file, which simply acts as an alias to filename.
def remote_create_from_zip(cls, file=None, parent_id=None, api=None, filename=None):

  • The method now needs to validate that filename or file came through.

We can post breaking changes in the README.md that filename is deprecated and file will take its place (and that the method is now polymorphic).

In the next major patch, I will remove filename.

from facebook-python-business-sdk.

tomako avatar tomako commented on March 28, 2024

Alright, it sounds good.
So should add a new field to AdImage and deal with it on the same way as do with filename (string vs. object checking). And the zip method also would get a new field as you defined. Must validate that filename or the new field is passed (and also the parent_id).
The only thing we should agree the name of this new parameter. Since file is a type name I wouldn't use it although it would be perfect. What about image_file and zip_file (for zip method)?

from facebook-python-business-sdk.

tomako avatar tomako commented on March 28, 2024

Hah, for all my caveats I just spotted in the standard lib that ZipFile has a file parameter and the description is suprisingly "file can be either a path to a file (a string) or a file-like object". I don't fight :)

from facebook-python-business-sdk.

 avatar commented on March 28, 2024

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

from facebook-python-business-sdk.

rituparnamukherjee avatar rituparnamukherjee commented on March 28, 2024

Closing this out because AdImage is one of the autogenerated files. We will try and incroporate this change in our codegen framework

from facebook-python-business-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.